Last post Jun 26, 2013 03:13 AM by vijaycool
Apr 19, 2011 12:28 AM|suresh.mekkattil|LINK
In the modern web development, we need to check the beowser compatibility for our webpages. This can include changing the css classes, style to fix the design issues. Using ASP.NET we can check the browser compatibility without writing a single line of code
for the server controls.
Let's check out some code samples:
If we will define css classes like:
Create a Label control in your page.
<asp:Label ID="lblTest" runat="server" ie:CssClass="IEStyle"
mozilla:CssClass="FFStyle" CssClass="DefaultStyle" ie:Text="You are in Internet
explorer." mozilla:Text="You are in Firefox." Text="You are in other browser."
Just make page run in the different browser and see the changes as belowOutput:IE : You are in Internet explorer.FF : You are in Firefox.Others : You are in other browser.
You can try the same with the TextBox control.TextBox Control:
<asp:TextBox ID="TestTextBox" runat="server" ie:Text="You are in Internet explorer." mozilla:Text="You are in Firefox." Text="You are in other browser." ie:CssClass="IEStyle" mozilla:CssClass="FFStyle" CssClass="DefaultStyle" />
We can use these setting for all server controls.
NOTE : There is no intellisense available for above in Visual Studio.
Jun 26, 2013 03:13 AM|vijaycool|LINK
This works fine in firefox and IE, but in chrome it shows 'you are in firefox'!
Though it's a nice post. thanks :)