.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Bug in Asp.Net 2.0 WebControlAdapter

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :Windows Application

There is bug in the WebControlAdapter class that can be very annoying, so I thought I'd fill eveybody in on the details.

The WebControlAdapter by default calls base.Render in it's render method. On most occasions, this is no problem. However, for TextBox it is. Try adding a multiline textbox and adding a TextBox control adapter using the WebControlAdapter base class: the multine textbox refuses to maintain it's state. All was working well for regular textboxes, so had a look at the .net internals to figure out what's going on. It turns out that the textbox rendering method has a conditional statement for rendering multiline textbox controls which get's ignored when using the WebControlAdapter. So when writing an adapter for the textbox control, you always have to implement to render method, like so:

            if (Extender.AdapterEnabled)
                //base.Render(writer); // this causes a bug where multiline textboxes can't maintain state

View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend