Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are two possibilities:</p> <ol> <li><p>Server side: subscribe for the <code>OnSelectedIndexChanged</code> event and enable AutoPostBack:</p> <pre><code>&lt;asp:CheckBoxList ID="CheckBoxList1" RepeatDirection="Horizontal" runat="server" AutoPostBack="true" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged"&gt; &lt;asp:ListItem Value="1"&gt;French&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="2"&gt;Spanish&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="3"&gt;Italian&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="4"&gt;German&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="5"&gt;Portuguese&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="6"&gt;Chinese&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="7"&gt;Japanese&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="8"&gt;Russian&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="Other"&gt;Other&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="None"&gt;None&lt;/asp:ListItem&gt; &lt;/asp:CheckBoxList&gt; </code></pre> <p>and in the code behind:</p> <pre><code>protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { var listItems = CheckBoxList1.Items.Cast&lt;ListItem&gt;(); var isNoneSelected = listItems.Any(x =&gt; x.Value == "None" &amp;&amp; x.Selected == true); if (isNoneSelected) { listItems.Where(x =&gt; x.Value != "None").ToList().ForEach(x =&gt; x.Selected = false); } } </code></pre></li> <li><p>Client side: use javascript to detect when the user clicks on the None checkbox and uncheck the others.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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