mattlaltman
asked on
Accessing controls within a FormView and Panel
This is probably easy but I can't figure it out (newbie). I have a Drop down list that's located within a FormView and within a panel. When I try to access the control from the code behind page, it doesn't recognize it. I'm assuming it's because it's within other controls. I'm not sure what the proper way is to access it.
Thanks for your help in advance!
Thanks for your help in advance!
Here is my asp.net code:
<asp:FormView
id="frmCreateDist"
DataSourceID = "srcCreateDist"
DefaultMode = "Insert"
Runat="server">
<InsertItemTemplate>
<asp:Panel
ID="Panel1"
GroupingText="Create Dist"
runat="server">
<br />
<asp:DropDownList
ID="ddlStateList"
runat="server"/>
</asp:Panel>
</InsertItemTemplate>
</asp:FormView>
Here is my code behind page. ddlStateList is unrecognizable:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ddlStateList.DataSource = StateManager.getStates()
ddlStateList.DataTextField = "FullAndAbbrev"
ddlStateList.DataValueField = "Name"
ddlStateList.DataBind()
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER