AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 How to Dynamically Enable/Highlight RSS Button in IE or FireFox From Asp.Net?
Posted by Moderator1 on  9/24/2009 10:18:02 AM 5574 Views
Now days, every web browser has the capability of identify the existence of RSS feeds in the web page. Most of the developer/programmer think it as a built-in function of the browser. But it is NOT.

We have to include script in the html between the <head></head> tags, then only the web browser either IE or FireFox, will identity the RSS feeds in the page and enable the RSS button in it. The link to be added between the <head></head> tags are below

<link rel="alternate" type="application/rss+xml" title="AspdotnetCodes.com - Latest Articles" href="http://www.aspdotnetcodes.com/rss.aspx" />

After you add the above <link /> script, browse your page, you can see the RSS button is enabled.

Now, to add the above link script dynamically from the code-behind, add the below code in your page event.

HtmlLink link = new HtmlLink();
link.Attributes.Add("rel", "alternate");
link.Attributes.Add("type", "application/rss+xml");
link.Attributes.Add("title", "AspdotnetCodes.com - Latest Articles");
link.Attributes.Add("href", "http://www.aspdotnetcodes.com/rss.aspx");
Page.Header.Controls.Add(link);

Post New Tips/Tricks View all Tips/Tricks

Featured Resources:
The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition - Free 207 Page Preview!
A compilation of the best solutions provided to common PHP questions.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time.
100% Free Subscription until Stock lost.View complete list.
Sponsored by