<asp:DataList runat="server" ID="MaterialList"> <ItemTemplate> <asp:Label ID="MaterialId" runat="server" Text='<%# Eval("MaterialId")%>' Visible="false"></asp:Label> <div style="padding-bottom: 5px;"> <asp:CheckBox ID="MaterialNameChk" runat="server" Text='<%# Eval("MaterialName")%>' OnCheckedChanged="MaterialNameChk_CheckedChanged" AutoPostBack="true" /> </div> </ItemTemplate> </asp:DataList>
protected void MaterialNameChk_CheckedChanged(object sender, EventArgs e) { if (sender != null) { CheckBox checkbox = (CheckBox)sender; DataListItem item = (DataListItem)checkbox.NamingContainer; Label idlbl = (Label)item.FindControl("MaterialId"); // Reset.Text = "Reset"; } }
protected void MaterialNameChk_CheckedChanged(object sender, EventArgs e) { if (sender != null) { CheckBox checkbox = (CheckBox)sender; if(checkbox != null) { Label idlbl = checkbox.Parent.FindControl("MaterialId") as Label; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)