Dictionary<string, string> openWith = new Dictionary<string, string>(); // Add some elements to the dictionary. There are no // duplicate keys, but some of the values are duplicates. openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "paint.exe"); openWith.Add("rtf", "wordpad.exe"); DDL.DataSource = openWith .Select(r => new KeyValuePair<string, string>(r.Key, r.Value)) .ToList(); DDL.DataTextField = "Key"; DDL.DataValueField = "Value"; DDL.DataBind();
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Monday, September 8, 2014
Bind a Dictionary to a DropDownList
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment