Hi,
I am working on windows applications.
var pinCodeObject=.....;//I got pincode object with my logic
I have one statedropdownlist
for the following code,
statedropdownlist.selectedvalue=pinCodeObject.Statecode;
In this case I am getting pinCodeObject.Statecode is some value(not null)
but after executing this line also statedropdownlist.selectedvalue is null
note:I bound statedropdownlist items in form load event with values which are pinCodeObject.Statecode and text is state names.
Please tel me how can i set selectedvalue dynamically in code
Dropdownlist selectedvalue always null while changing dynamically in c#code !h
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jean PaulRank #32 · 38.5K reputationPosted Oct 19, 2011, 5:43 AM EDT
Instead of using SelectedValue you can try with the SelectedIndex.
raja ramesh46 reputationPosted Oct 19, 2011, 10:42 PM EDT