<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

Why formatting of a ASP.NET page looks different when rendered through VWD & IIS

A puzzled ASP.NET developer asked on the ASP.NET Forums why the formatting of the same ASP.NET page looked different in Internet Explorer when rendered by Visual Web Developer & IIS seperately. When the entire source code is the same, why should they look different?

Dave Sussman has this insightful answer -
It's possible the application is running on IIS under a v4 application pool, meaning it will be run as though it were a v4 application, so the control rendering might be different. Two things to do:

1. On IIS machine, select the application and from the Actions tab on the right, select "Basic Settings ...". From the dialog that pops up, select the appropriate application pool (Classic .NET AppPool for an ASP.NET 2.0 application).


2. In Web.Config, in the <system.web> section add:

<pages controlRenderingCompatibilityVersion="3.5" />

That will ensure the controls are rendered as though the application was ASP.NET 3.5, so should be consistent on both machines.

A standard ASP.NET control may render a different kind of source depending on which Framework it targets.  For instance, ASP.NET 4 brings the following major rendering changes:

  • The Image and ImageButton controls no longer render a border="0" attribute.
  • The BaseValidator class and validation controls that derive from it no longer render red text by default.
  • The HtmlForm control does not render a name attribute.
  • The Table control no longer renders a border="0" attribute.
  • Controls that are not designed for user input (for example, the Label control) no longer render the disabled="disabled" attribute if their Enabled property is set to false (or if they inherit this setting from a container control).

Also see:

Labels: ,

Tweet this | Google+ it | Share on FB

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


Post a Comment