DropDownList inside GridView: How to set SelectedIndex for the DropDownList?

K

keithb

With a DropDownList in a GridView Edit Template, how can I set the
SelectedIndex property so that the list initializes to the value shown in
the Display template? When I set SelectedIndex to -1, the DropDownList
initializes to the first entry.
<asp:DropDownList ID="DropDownList2"

runat="server"

Width="75px"

DataSource='<%# ReleasesAccess.GetReleases() %>'

DataValueField = '<%# "RelID" %>'

DataTextField = '<%# "ShortName" %>'

SelectedIndex= '<%# -1 %>' >

</asp:DropDownList>

Thanks,

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top