ASP.Net - DropdownList - AddItems

Initializing a Drop Down List control from a set of hardcoded values

You could always use the wizard built into collections function of the property sheet, or you could write a bit of code which might look something like this

1
2
3
4
5
ddlSsoType.Items.Insert(0, New ListItem("RQ", "R"))
ddlSsoType.Items.Insert(0, New ListItem("Non-RQ", "N"))
ddlSsoType.Items.Insert(0, New ListItem("Not-SSO", "X"))
ddlSsoType.Items.Insert(0, New ListItem("", "-"))
ddlSsoType.DataBind()

In the listitems, the first value is what is shown on the dropdown control, the second value is what is returned to the code as the value of the dropdown.