jeudi 30 novembre 2017

Click div to toggle inner checkbox

I have a DataList with an ItemTemplate inside of it which creates the following ui:

ui

snippet:

    <asp:DataList ID="DataList1" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" DataKeyField="Key">

            <ItemTemplate>
                <div id="Row">
                    <div id="Cell">
                        <div id="Permission_Label_Div">
                            <asp:Label runat="server" ID="Permission_Label" Text='<%# Eval("Key") %>'></asp:Label>
                        </div>

                        <div id="Permission_CheckBox_Div">
                            <asp:CheckBox runat="server" AutoPostBack="true" ID="Permission_CheckBox" Checked='<%# Eval("Value") %>' />
                        </div>
                    </div>
                </div>
            </ItemTemplate>

        </asp:DataList>

What I'm having trouble doing is allowing the user to toggle the check boxes by clicking on its respective div.I'm assuming since the DataList is an asp server control, I would have to wait for the page to finish loading before I can access each DataList item. Any help would be appreciated.




Aucun commentaire:

Enregistrer un commentaire