Quantcast
Channel: Dropdownlist loses SelectedIndex after DataBind
Viewing all articles
Browse latest Browse all 15

Dropdownlist loses SelectedIndex after DataBind

$
0
0

I notice that a dropdownlist loses its selectedindex after a databind call from code. Whereas a gridview control retains its selectedindex. Isn't this kind of inconsistent?

A workaround for the dropdownlist to maintain the selectedindex on databind is to store it in a variable and restore it afterwards, but then you might get an error if this index doesn't exist anymore. I wonder if there is a better way.


Viewing all articles
Browse latest Browse all 15

Latest Images

Trending Articles





Latest Images