Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CS Nuglet: Adding a Read More link to Aggregate Blog List control

Interesting request today on Community Server Forum Space with the request for a [Read More] link on a Blogs Aggregated Post List.  The Read More link control was added to the Skin-AggregatedList.ascx control, but nothing was happening!  One would assume the link would be created, since that's how the individual blog EntryList control works.  But the Aggregated Post List control doesn't support a "Read More" link.  The Post Title takes you to the article and does the job.  But sometimes, yes sometimes, hyperlinked titles are not enough.

The reason the Read More link control added to AggregateList.ascx didn't do nothin' was because there was no binding going behind the scenes in blogs\Aggregatelist.cs.  But that is easily remedied.

First add the Read More hyperlink to your \themes\default\skins\skin-AggregateList.ascx control after the Literal id="Body" control.

<asp:HyperLink id="ReadMoreLink" Runat="server" />


Then add the following to support it in the posts_ItemDataBound() method of the AggregateList.cs class.

 

// DBVT Modified
HyperLink readMore = e.Item.FindControl("ReadMoreLink") as HyperLink;
if (readMore != null)
{
readMore.Text = ResourceManager.GetString("Weblog_EntryList_ReadMore");
readMore.NavigateUrl = Globals.IsNullorEmpty(post.TitleUrl) ? BlogUrls.Instance().Post(post) : post.TitleUrl;
}
// end DBVT

 

You may want to add a new Resources.xml string value or remove the body block elipses to make it all nice and pretty...

 

Comments (0) | Post RSS RSS comment feed

Posted on 1/5/2007 12:08:12 PM by Dave Burke
Categories: Community Server
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke