<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8211560\x26blogName\x3dTech+Tips,+Tricks+%26+Trivia\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://mvark.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://mvark.blogspot.com/\x26vt\x3d-5147029996388199615', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Tech Tips, Tricks & Trivia

by 'Anil' Radhakrishna
An architect's notes, experiments, discoveries and annotated bookmarks.

Search from over a hundred HOW TO articles, Tips and Tricks

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:

<asp:TextBox id="txtSecret" runat="server" AutoCompleteType="Disabled" >


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


Tweet this | Google+ it | Share on FB

« Home | Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »

Posted by Blogger Tasnim | 1/25/2009 08:03:00 PM

Well i tried it,
but its not working for me in firefox...    

Posted by Blogger Tasnim | 1/25/2009 08:06:00 PM

i tried ur method.but it doesnt seem to work for me in firefox.

Any idea why?    

Posted by Blogger ]matmat[ | 6/04/2009 02:38:00 AM

What about:

TextBox ID="txtAnswer" runat="server" width="100%" AutoComplete="OFF"    


Post a Comment