Last post Jan 07, 2011 03:13 PM by ThatMatthew
Dec 27, 2007 11:14 AM|Rinze|LINK
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:
//base.Render(writer); // this causes a bug where multiline textboxes can't maintain state
if (textbox.TextMode == TextBoxMode.MultiLine)
Oct 23, 2008 01:03 PM|schubboy|LINK
Jan 07, 2011 03:13 PM|ThatMatthew|LINK
Thanks, Rinze! What a weird issue.