Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are not doing anything wrong, that's <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.aspx" rel="nofollow">the default behaviour of asp.net.</a> That is otherwise achieved with <code>&lt;asp:CheckListBox /&gt;</code> control: <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.aspx" rel="nofollow">CheckListBox</a></p> <pre><code> &lt;asp:CheckBoxList id="checkboxlist1" AutoPostBack="True" CellPadding="5" CellSpacing="5" RepeatColumns="2" RepeatDirection="Vertical" RepeatLayout="Flow" TextAlign="Right" OnSelectedIndexChanged="Check_Clicked" runat="server"&gt; &lt;asp:ListItem&gt;Item 1&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Item 2&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Item 3&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Item 4&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Item 5&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;Item 6&lt;/asp:ListItem&gt; &lt;/asp:CheckBoxList&gt; </code></pre> <p>That shows how to add items manually. You can also populate the check list from database</p> <pre><code> System.Data.DataTable dtOptions = GetValuesFromDataBase(); checkboxlist1.DataSource = dtOptions; checkboxlist1.DataBind(); </code></pre> <p><strong>Update</strong></p> <p>In Asp.Net 4 and above, you are given more control on <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientidmode.aspx" rel="nofollow">how control ID are generated (e.g. AutoID, Static, Predictable, Inherit)</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload