How do you change the BlogRoll title?

Topics: ASP.NET 2.0, Controls
Aug 11, 2008 at 3:34 PM
Great application, just started on 1.4.5.
 
I have searched and searched but cannot find a way to change the BlogRoll title, even in the code.

I would prefer to call it "Industry News", how can I achieve this?
Aug 11, 2008 at 11:18 PM
There are two ways you can do this. A quick and dirty way and one much less so.

Quick and dirty:
1. Edit the /widgets/BlogRoll/widget.ascx.cs file and add the following line in the LoadWidget method:

Title = "Industry News";

Done!

The cleaner approach:
1. Add a new User Control to the /widgets/BlogRoll/ folder and call it edit.ascx
2. Edit the edit.ascx.cs file and make it derive from WidgetEditBase
3. Override the abstract Save method:
public override void Save() {}
4. Fire up the blog and sign in, step down to the BlogRoll widget and click on Edit
5. Change the title to Industry News

Done!

Details:
Since you're using version 1.4+ the BlogRoll is a widget. Or more specifically, a control rendered inside a widget. Anyway, the title is a fundamental part of the widget framework and it is automagically set from the Widget name when added to the widget zone. You get the title editing for free when you only add an edit User control and I guess the BlogEngine team never thought about your requirement when they implemented the BlogRoll widget. This is why the second, clean approach is so nice since you get the user experience of chosing your own title and you don't need to change any of the BlogEngine code.

Best regards
Rickard Nilsson
http://rickardnilsson.net
Aug 12, 2008 at 7:31 AM
You can change only one word in code to make your BlogRoll title customizable.

Goto this folder: widgets\BlogRoll, there's a file widget.ascx.cs in it, open it with NodePad, you'll see there's something like this:

 public override bool IsEditable
 {
  get { return false; }
 }

just change the word "false" to "true", then upload the modified file to replaced the old one, you'll be able to customize the widget title.

This method is applicable to any widget.
Aug 12, 2008 at 8:15 AM
Yes, you're right. I forgot that small step in my explanation and it turns out that is all it takes. Thanks miller.
Aug 12, 2008 at 10:10 AM
Miller's suggestion works, thank you.

I have also learnt more about the application from your explanation Ricard so thank you too.