Alex Rivera | Logout

Databound drop down list - initial value

Asked 2009-02-06T17:44:46.510
28

How do I set the initial value of a databound drop down list in ASP.NET?

For instance, I want the values, but the first value to display should be -- Select One ---, with a null value.

Edit
Report

1 Answer

1

To select a value from the dropdown use the index like this:

if we have the

<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true"></asp:DropDownList>

you would use :

DropDownList1.Items[DropDownList1.SelectedIndex].Value

this would return the value for the selected index.

answered 2011-02-05T12:58:26.427

Your Answer