Access DropDownList inside a FormView's header template

I have a FormView which I want to put a DropDownList in (named "customerList").  I want to be able to handle the SelectedIndexChanged event of customerList, but VS2005 doesn't recognize that as a valid variable name.  What do I need to do?
LVL 12
netsmithcentralAsked:
Who is Participating?
 
netsmithcentralConnect With a Mentor Author Commented:
You need to use the FindControl method of the FormView and then do an implicit cast to access it.
<asp:FormView ID="theFormView" ...>
    <ItemTemplate>
        <asp:DropDownList DataSourceID="myDataSource" ID="theDDL" />
.
.
.
    </ItemTemplate>
.
.
.
</asp:FormView>
 
 
Protected Sub useData()
   Dim ddl As DropDownList = theFormView.FindControl("theDDL)
   ddl.SelectedValue...
End Sub

Open in new window

0
 
MrAgileCommented:
Hi,
please post the source code.
0
 
Vee_ModCommented:
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0
All Courses

From novice to tech pro — start learning today.