Bryan Soltis

Senior Software Engineer
MCPD: Enterprise Application Developer 3.5
MCSD.NET, MCAD, MCP

BlogEngine.NET Positional Breadcrumbs

Saturday, October 11, 2008 08:08 | posted by: bryan

In developing the Bit-Wizards Blogs theme, I found that there was a lack of positional breadcrumbs in BlogEngine.NET.  I found many that were "Historical", or “Hierarchical", but these did not fit our needs.  So I created a simple user control that displays a link back to the blog home when a user views a post or sub page.


protected void Page_Load(object sender, EventArgs e)
{
//Make sure user is on a page that is not the home page
if (!(Request.Url.AbsoluteUri.ToLower()).EndsWith("default.aspx"))
{
if (Request.QueryString["id"] != null)
{
if (Request.QueryString["id"] != "")
{
//Determine the post the user is on
Guid id = new Guid(Request.QueryString["id"]);
Post post = Post.GetPost(id);
//Build the breadcrumb text
StringBuilder sb = new StringBuilder();
sb.Append(
"<div id=\"Breadcrumb\"><div id=\"Breadcrumbtext\">");
sb.Append(
"<a href=\"" + Request.ApplicationPath + "\">Blog Home</a> > ");
sb.Append(post.Title);
sb.Append(
"</div></div>");
litBreadcrumbs.Text = sb.ToString();
}
}
}
}

 

Tags:

PermaLink   E-Mail Article   RSS Comment Feed  

Add comment


(Will show your Gravatar icon)
Click to change captcha
biuquote
  • Comment
  • Preview
Loading