Thursday, April 1, 2010

dropdownlist postback selectedindex 0

asp.net dropdownlist should have unique value item, i.e.

ddl.items.add(new listitem(key, value)) -> here value should be unique
otherwise on postback you get incorrect selectedindex.

e.g.
ddl -> America, 1
Europe, 2
Asia, 3
is correct

but

ddl -> America 1
Europe 1
Asia 2

is not correct

No comments:

Post a Comment