Tuesday, April 3, 2007

ASP.Net DropDownList

Asp.net DropDownList does not work
The two events OnSelectedIndexChanged and OnTextChanged seem to actually check if the value of the dropdown list has changed. When queried what the selected index is it will give you the first value that has the selected value. Basically the OnSelectedIndexChanged is incorrectly named, it should be OnSelectedValueChanged.
Other bugs in this control are .SelectedValue actually returns the lowest indexed listitem with the selected value, and when you would expect .Text to map to the visible text it actually is the corresponding value (so both of these are incorrect in kinda the same way).
Because of this, the OnTextChanged event does actually work "correctly" just not at all intuitively and it appears that it too comes under the nonexistent OnSelectedValueChanged event.
To be honest im a little disappointed that this has persisted through to .Net 3.0, I would love to hear a why this is still the case.
How I have found this (yes i'm sure millions of other have), is a client wants duplicate values with diffent text in a drop down... not sure if there is a real business reason, bu theres the background anyway.

End rant, sorry my firstone was negative... oh well

See you soon :)

1 comment:

mark said...

your one sexy bitch.