HOW TO control ASP.NET's Adaptive Rendering behavior
ASP.NET server controls detect browser type automatically & render differently in modern non-IE browsers like Opera & Firefox. Sometimes this may be undesirable. For instance, a textbox server control with the property AutoCompleteType="Disabled" like so:
is rendered as this in IE 6 -
whereas it will adaptively render without the autocomplete attribute in Firefox 2.0 like this -
Although the autocomplete attribute is a non-standard HTML property it is supported in Firefox. So how do we make this attribute show up in Firefox?
By setting the @ Page directive's ClientTarget property to "uplevel", we can force the page to render in Firefox (or any other non-IE browser) as it does in IE 6.
You may have to verify that your other tags also render as desired in non-IE browsers.
Related reading:
ASP.NET Web Server Controls and Browser Capabilities
Architectural Overview of Adaptive Control Behavior
Dissecting Adaptive Rendering
A Look at ASP.NET's Adaptive Rendering
<asp:TextBox id="txtSecret" runat="server" AutoCompleteType="Disabled" >
</asp:TextBox>
is rendered as this in IE 6 -
<input name="txtSecret" type="text" autocomplete="off" id="txtSecret" />
whereas it will adaptively render without the autocomplete attribute in Firefox 2.0 like this -
<input name="txtSecret" type="text" id="txtSecret" />
Although the autocomplete attribute is a non-standard HTML property it is supported in Firefox. So how do we make this attribute show up in Firefox?
By setting the @ Page directive's ClientTarget property to "uplevel", we can force the page to render in Firefox (or any other non-IE browser) as it does in IE 6.
<%@ Page Language="C#" ClientTarget="uplevel" %>
You may have to verify that your other tags also render as desired in non-IE browsers.
Related reading:
ASP.NET Web Server Controls and Browser Capabilities
Architectural Overview of Adaptive Control Behavior
Dissecting Adaptive Rendering
A Look at ASP.NET's Adaptive Rendering
Well i tried it,
ReplyDeletebut its not working for me in firefox...
Hi,
ReplyDeletei tried ur method.but it doesnt seem to work for me in firefox.
Any idea why?
What about:
ReplyDeleteTextBox ID="txtAnswer" runat="server" width="100%" AutoComplete="OFF"