/ Published in: ASP

usage:
SomeDropDownList.Set("Some String Value");
SomeDropDownList.Set("Some String Value");
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static void Set(this DropDownList ddl, string findByVal) { // attempts to set a DDL to the 'findByVal' try { ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(findByVal)); } catch { }; // otherwise statys at the default, avoids errors }
URL: http://naspinski.net/post/Simplify-setting-your-DropDownLists-to-a-specific-value.aspx
Comments
