Checklistbox selected value in Repeater control

SlightlyMad

New member
Joined
Jun 7, 2004
Messages
2
Programming Experience
3-5
Hi

I have a data repeater that contains a checkboxlist.

Can anyone tell me how to retrieve the selected value when a submit button is pressed?

VB.NET:
<asp:repeater id=dl runat="server" DataSource="<%# bound %>">
                                <HeaderTemplate>
                                    <TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="1">
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <TR>
                                        <TD bgcolor="#0099cc">
                                            <asp:Label id="Question1" runat="server" text='<%#  DataBinder.Eval(Container.DataItem, "Question") %>' ForeColor=#ffffff>
                                            </asp:Label>
                                        </TD>
                                    </TR>
                                    <TR>
                                        <TD>
                                            <asp:CheckBoxList id="clbAnswer"   runat="server" DataSource='<%# DLSource(CInt(Databinder.Eval(Container.DataItem,"QID"))) %>' DataTextField="Answer" >
                                            </asp:CheckBoxList>
     
                                        </TD>
                                    </TR>
                                </ItemTemplate>
                                <FooterTemplate>
            </TABLE>
            </FooterTemplate> </asp:repeater>
 
in the prerender event or onclick event of the checkbox, put a loop in to find the selected item. i.e.
for i as integer = 0 to clbAnswer.Items.Count
if clbAnswer.Items(i).Checked then
'this is the selected item
end if
next
 
Back
Top