Google Reader Picks Widget

January 10, 2009 17:51 by daub815

Like most people, I don't like to reinvent the wheel.  I wanted to add my Google Reader shared items to my blog via the BlogEngine.Net widget framework.  I found a great widget.  So I installed the widget and followed his instructions.  Unfortunately, I ran into a few issues.

It wasn't displaying any of my shared items, which I kept on blaming on my IIS permissions (aka not being able to write the settings to the app_data directory).  I gave everyone full control to the app_data directory, but to no avail.  Then I noticed an interesting item.  When I clicked save on the edit dialog for the widget, my userId would disappear.  So I compared my the TextBox Widget edit.ascx.cs code with the new widget's code.

Google Reader Picks widget:

protected override void OnLoad(EventArgs e)
{
    StringDictionary settings = GetSettings();
    string userId = "";
    if (settings.ContainsKey("userId"))
        userId = settings["userId"];
	//Function continues, but you get the point
}

TextBox widget:

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        StringDictionary settings = GetSettings();
        txtText.Text = settings["content"];
    }
}

Not sure what has changed between July and now except maybe some BlogEngine.Net releases.  Either way, I changed the Google Reader Picks widget code to below:

protected void Page_Load(object sender, EventArgs e)
{
	if (!Page.IsPostBack)
    {
		StringDictionary settings = GetSettings();
        string userId = "";
        if (settings.ContainsKey("userId"))
        	userId = settings["userId"];
		//More settings saved below
	}
}

Not the big of a change, but it fixed my issue.  Much thanks to Juan for his widget.  Here is my modified version of the Google Reader Picks widget (3.16 kb).


Comments

January 11. 2009 09:51

Juan

Thanks for the fix.
It's still working on my blog though, but since I haven't installed blogengine.net latest releases yet, it may be the reason it stopped working (as you say).

I'm glad you liked it

Juan