1
How to scroll through several Checkboxes in the C# Button Click event where these Checkboxes were automatically generated with Jquery ?
The automatically generated Checkbox HTML is this:
<div class="col-md-12">
<div id="MainContent_pnlCheckbox">
<div id="MainContent_divCheckboxes">
<div>
<a>
<input type="checkbox" name="chkCI" id="2" runat="server" checked="checked" value="2">
<span>CI 2</span>
</a>
</div>
<div>
<a>
<input type="checkbox" name="chkCI" id="4" runat="server" checked="checked" value="4">
<span>CI 4</span>
</a>
</div>
</div>
</div>
</div>
The code to go through the Checkbox is:
foreach(Control item in divCheckboxes.Controls)
{
if(item is CheckBox)
{
CheckBox c = item as CheckBox;
if (c != null && c.Checked)
{
CIModel ci = new CIModel();
ci.idci = int.Parse(c.ClientID);
lCI.Add(ci);
}
}
}
But the above code does not find the Checkbox object:
Note: I am using a Masterpage.
Put the aspx. :)
– novic