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
Problem of binding dropdownlist to databse
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Soft CornerRank #1,221 · 1.5K reputationPosted Apr 21, 2011, 1:57 AM EDT
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;