ASP.NET Browsers Filter!!

Yesterday .NET SP1 released and many new features for ASP.NET where added. But yesterday i also discovered a feature that ASP.NET has from version 2.0

Let's say we have a button. We can decide what value will the properties have for different browsers!!! And we can do that with this way...

<asp:Button ie:Text="IEText" runat="server" mozilla:Text="FFText" />

The result in IE will be a button with IEText and in Firefox FFText.

Capture

The above works with all properties like OnClientClick!

This could be useful i.e. at file upload control where each browser handles different the rendering of the tag.

Cool eh?

kick it on DotNetKicks.com

 

5 Comments

  • Interesting, however, I've not been able to succesfully change it to work for IE6. Apparently you have to use a specific UserAgent string to create IE6-specific options in the web.config, which is only good for 10% of the actual IE6 users.

    This would be a good way to repair IE6 styles and javascript issues, which I now do manually.

  • Cool! Another hidden feature of ASP.NET 2.0 which was not mentioned in any of the books I've read.

  • iRrhai Really informative blog post. Much obliged.

  • Fantastic goods from you, man. I have understand your stuff
    previous to and you're just too great. I really like what you've acquired
    here, certainly like what you're stating and the way in which you say it. You make it enjoyable and you still take care of to keep it wise. I can not wait to read much more from you. This is actually a wonderful site.

  • I am really impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you modify it yourself? Either way keep up the nice quality writing, it is rare to see a great blog like this one nowadays..

Comments have been disabled for this content.