BlogEngine.NET 3.2 Hosting Tips – How to Add a custom Property to BlogEngine.NET Posts?

I post it here because I simply spent the last many hours attempting to figure this out and currently that I resolved it, I felt like sharing just in case other people are attempting to add a property or attribute to a BlogEngine.Net page. It’s not onerous, once you work it out! Anyways, this website is run on BlogEngine and I am rather happy with it. I have another site I am working on, however I need much more static pages with searchable attributes. This isn’t really something Blog Engine is designed to do out of the box. You can of course add tags to blog posts, but that doesn’t really work well for non-chronological pages.


So, I added it to the page object itself. In this case I am going to add a single new entity to the Page, published Year. first obviously you need the BlogEngine source code, download the source release. Extract the project then open BlogEngine.sln inside the BlogEngine folder in Visual Studio.


First, in BlogEngine.core, locate Page.cs.

Now add the following code:

/// <summary>
/// Added by me to support published year
/// </summary>
private string publishedYear;
/// <summary>
///     Gets or sets a value indicating Published Year
/// </summary>
public string PublishedYear
return this.publishedYear;
base.SetValue("PublishedYear", value, ref this.publishedYear);

Now you need to add a GUI for it, so you can actually set the Published Year. Open EditPage.aspx. First lets add the html. I put it so it will appear in the side area of the form, above keywords. Locate the Keywords LI ( included below for reference ) and add the following method:

<label class="lbl" for="<%=txtPublishedYear.ClientID %>">Published Year</label>
<asp:TextBox runat="server" ID="txtPublishedYear" TextMode="SingleLine" />
<label class="lbl" for="<%=txtKeyword.ClientID %>"><%=Resources.labels.keywords %>
<asp:TextBox runat="server" ID="txtKeyword" TextMode="MultiLine" Rows="5" />

Also in EditPage.aspx locate the SavePage() javascript method, and change it as follows:

var publishedYear = $("[id$='txtPublishedYear']").val();
var dto = {
"id": Querystring('id'),
"content": content,
"title": title,
"description": description,
"publishedYear": publishedYear,
"keywords": keywords,
"slug": slug,
"isFrontPage": isFrontPage,
"showInList": showInList,
"isPublished": isPublished,
"parent": parent

Order is important here. Now open EditPage.aspx.cs. Locate the PindPage() method and add:

this.txtPublishedYear.Text = page.PublishedYear;
Now locate BtnSaveClick() and modify to look like:
page.Description = this.txtDescription.Text;
page.Keywords = this.txtKeyword.Text;
page.PublishedYear = this.txtPublishedYear.Text;
if (this.cbFrontPage.Checked)

Finally open AjaxHelper.aspx.cs in the admin folder. Locate the SavePage() method and make the following change:

public static JsonResponse SavePage(
string id,
string content,
string title,
string description,
string publishedYear,
string keywords,
string slug,
bool isFrontPage,
bool showInList,
bool isPublished,
string parent)

These parameters need to be in the same order as the dto object created earlier. So make sure your publishedYear setting is in the same position in both. Now scroll down a little further in the SavePage() method and make the following change:

page.Description = description;
page.PublishedYear = publishedYear;
page.Keywords = keywords;

And, you are now done. Compile and run. Now when you go into your Page admin um, page, it should look like this:


Which Provider who can Give You The Best and Recommended BlogEngine.NET 3.2 Hosting?

Happily, there are several reliable and recommended Web hosting out there that can help you get a handle on site speed and work to increase your BlogEngine.NET 3.2 web rank. We are here to recommend you HostForLIFEASP.NET. HostForLIFEASP.NET is the most popular choice for people looking to host for the first time at an affordable price in Europe.

Their regular price starts at € 3.00/month only. Customers are allowed to decide on quarterly and annual plan supported their own desires. HostForLIFEASP.NET guarantees “No Hidden Fees” and industry leading ‘30 Days Cash Back’, folks might ask for a full refund if they cancel the service at intervals the first thirty days.

HostForLIFEASP.NET also give their customers an opportunity to create some cash by providing reseller hosting accounts. you’ll purchase their reseller hosting account, host unlimited websites thereon and even have the prospect to sell a number of your hosting area to others. This could be one amongst the best ways that of creating some cash on-line. You are doing not have to be compelled to worry concerning hosting stuff as they’ll beware of all the hosting desires of your shoppers.