Avatar of Robb Hill
Robb Hill
Flag for United States of America asked on

Setting the index value of a dropdownlist when its created

I have a dropdownlist in asp.net 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"
Web Languages and Standards

Avatar of undefined
Last Comment
Robb Hill

8/22/2022 - Mon
Michel Plungjan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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...?
Robb Hill

ahh..I used the on Pre render event to fire this change....

Thanks for the help

Your help has saved me hundreds of hours of internet surfing.