View Single Post
Old September 11th, 2006, 09:35 AM
bttrflii bttrflii is offline
Registered User
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default selected value of nested repeater-build <select>

i have a drop down list (a <select> element) constructed with a repeater nested within a repeater so that i can use <optgroup>s.

<asp:Repeater ID="rptIssuesNotInRelease" runat="server" DataSourceID="sdsSectionsNotInRelease">
        <select id="ddlIssuesNotInRelease">
        <asp:HiddenField Value='<%# Eval("SectionID") %>' ID="hidSectionID" runat="server" Visible="false"/>
        <optgroup label='<%# Eval("Name") %>'>

            <asp:Repeater ID="rptIssuesInSection" runat="server" DataSourceID="sdsIssuesInSection">
                    <option value='<%# Eval("IssueID") %>'><%# (Eval("Problem").ToString().Length > 100 ? Eval("Problem").ToString().Substring(0, 100) + "..." : Eval("Problem")) %></option>

the code it produces is something like (picture this as a drop down list with groups):

+ Section 1 +
   Item A
   Item B
+ Section 2 +
   Item C
   Item D

whichever item my user selects, i need to get the value of that selected item. trying to use FindControl inside my "add to release" button event produces a null control.

System.Web.UI.HtmlControls.HtmlSelect ddlIssuesNotInRelease = (System.Web.UI.HtmlControls.HtmlSelect)rptIssuesNotInRelease.FindControl("ddlIssuesNotInRelease");

what i am missing? how can i access the value of my drop down list during my button click event? am i creating optgroups with asp all wrong?