Skip to main content

Posts

Showing posts from November, 2008

Programmatically add the META tags to an ASP.NET page

Do you want to programmatically add the META tags to an ASP.NET page? You can try to the below code: HtmlMeta metaDesc = new HtmlMeta(); metaDesc.Name = "description" ; metaDesc.Content = "Your Description goes here" ; Page.Header.Controls.Add(metaDesc); HtmlMeta metaKey = new HtmlMeta(); metaKey.Name = "keywords" ; metaKey.Content = "Your keywords here" ; Page.Header.Controls.Add(metaKey);

Adding a separator image to ASP.Net Menu Control

This what I did to add a separator to ASP.Net menu. I used Web.sitemap to bind the data to menu control. This how Web.sitemap looks like. <sitemap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"> <sitemapnode> <sitemapnode url="~/Pages/DatingHome.aspx" title="Home" description="" separatorImageUrl="../../Images/but_blueSlice.jpg"> <sitemapnode url="~/Pages/Inbox.aspx" title="Inbox" description="" separatorImageUrl="../../Images/but_blueSlice.jpg"> </sitemapnode> </sitemapnode> This separatorImageUrl will tell you the image path of the separator. This event handler will do the rest of it. protected void Menu2_MenuItemDataBound(object sender, System.Web.UI.WebControls.MenuEventArgs e) { SiteMapNode smNode = (SiteMapNode)e.Item.DataItem; if (smNode["seperatorImageUrl"] != null) e.Item.SeparatorImageUrl = smNode["