Thursday, September 29, 2011

Using CheckBox List Asp.net

In aspx file
 <asp:CheckBoxList ID="chkModuleList" runat="server">
 <asp:ListItem Text="Test 1" Value="1"></asp:ListItem>
 <asp:ListItem Text="Test 2" Value="2"></asp:ListItem>
 <asp:ListItem Text="Test 3" Value="3"></asp:ListItem>
  <asp:ListItem Text="Test 4" Value="4"></asp:ListItem>
  </asp:CheckBoxList>

In aspx.cs file
 for (int i = 0; i <chkModuleList.Items.Count; i++)
        {
string strtest = Convert.ToString(chkModuleList.Items[i].Selected);
//string strtest = Convert.ToString(chkModuleList.Items[i].Value);
//string strtest = Convert.ToString(chkModuleList.Items[i].Text); 
}

No comments:

Post a Comment