I have dropdownlist in which i am taking 4 values and also in run time i want to take only one value from database as selected value in it .
please help i am not getting
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Soft CornerPosted Apr 21, 2011, 5:57 AM
as you are adding 4 values in dropdwnlist , let say
DropDownList1.Items.Add("1");
DropDownList1.Items.Add("2");
DropDownList1.Items.Add("3");
DropDownList1.Items.Add("4");
and later you are adding 1 value from database at run time , let say
DropDownList1.Items.Add(DBValue); after this
set DropDownList1.SelectedIndex = 4;