Reputation: 18237
Hi i need to display a dropdownlist with data but disable, my problem it's then despite i set the only value that i need to show at the beginning of the application when i set enable false the data it's been clear, so i need to know if exit's another way to disable a dropdown but with data. Thanks
My Code
protected void Page_Load(object sender, EventArgs e)
{
//Initialize the combo
Dictionary<int,String> estate = new Dictionary<int,String>();
estadosVenezuela.Add(0,"Pick a state");
DropDownList2.DataValueField = "Key";
DropDownList2.DataTextField = "Value";
DropDownList2.DataBind();
DropDownList2.Enabled = false;
}
i need that the values pick a state appear's but with the dropdownlist disabled
Upvotes: 0
Views: 302
Reputation: 1390
You need to specify your DropDownList2.DataSource. Right now it's not being set so the list has nothing in it.
Upvotes: 4