Link to home
Create AccountLog in
Avatar of Robb Hill
Robb HillFlag for United States of America

asked on

Setting the index value of a dropdownlist when its created

I have a dropdownlist in 2.0.

This dropdownlist is populated from a SQLDATASOURCE control.

When the control is created the 1st item in the list does not let me click on it.  I am pasting the code below.  Please help.

<asp:SqlDataSource ID="TemplateSource" runat="server"
     ConnectionString="<%$  ConnectionStrings:NewDMSConnectionString %>"
     SelectCommand="select * from Template inner join Templatedetail on tmptype = RepType order by tmpName"

<asp:DropDownList id="TemplateList" Runat="Server"
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Robb Hill


This is not working.

I have this drop down list being rendered inside a view control.
The values in the dropdown list are being generated from asp datacontrol and are not being populated from any vb event.  I tried using your code in on load...and from the onclick event of the button on the previous page....and it doesnt seem to affect the dropdownlist....

How would you suggest I apply this code...?
ahh..I used the on Pre render event to fire this change....

Thanks for the help