While working on a dasBlog bug report I found an interesting "feature" in ASP.Net 2.0.   There are a few controls on the configuration page that can be enabled on the client side via JavaScript.  This worked fine and dandy in asp.net 1.1 but in 2.0 it stopped working.  The controls that were enabled on the client side never had any value after postback (in this case it was a CheckboxList). 

After first thinking it had something to do with how dasBlog dynamically loads the configuration usercontrol dynamically it was time to dig into the toolbox for the trusty reflector.  It turns out that asp.net 2.0 won't load the postback data of a checkbox list (or a listbox or dropdownlist) if the control is not enabled. In asp.net 1.1 the control's postback data was always loaded.  Since the controls were being enabled on the client side and not on the server side the postback data was never loaded.

The easiest way to solve the problem is to enable the checkbox list before the postback data is loaded (OnInit or Page_Load).  If needed you can still disable the control later in the page lifecycle.

Posted at 7/16/2007 10:37 PM
Comments [3] - Permalink
Tuesday, 17 July 2007 09:27:57 (Eastern Daylight Time, UTC-04:00)
I wonder why MS changed that.
Tuesday, 17 July 2007 11:14:53 (Eastern Daylight Time, UTC-04:00)
I'm not sure why they made the change. Maybe performance? They made a similar change with the textbox control and the "ReadOnly" property.

Monday, 24 July 2017 01:51:02 (Eastern Daylight Time, UTC-04:00)
What i don't understood is in reality how you're not
actually much more smartly-liked than you may be right
now. You are very intelligent. You know thus
significantly on the subject of this matter, made me personally imagine
it from a lot of numerous angles. Its like men and
women don't seem to be involved until it is something to
accomplish with Girl gaga! Your individual stuffs nice.
Always maintain it up!
Please login with either your OpenID above, or your details below.
Home page

Comment (Some html is allowed: a@href@title, i) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview