Binding DropDownList with Dictionary

Gow.Net
Posted by Gow.Net under ASP.NET category on | Points: 40 | Views : 1633
  Dictionary<string, string> states = new Dictionary<string, string>();
states.Add("-1", "-Select State-");
states.Add("AP", "Andhra Predesh");
states.Add("KA", "Karnataka");
states.Add("TN", "Tamilnadu");
states.Add("KL", "Kerala");
ddl1.DataSource = states;
ddl1.DataValueField = "Key";
ddl1.DataTextField = "Value";
ddl1.DataBind();

Comments or Responses

Login to post response