Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd checkboxlist item onclick of another checkbox
    text
    copied!<p>I'm just wondering if there's a way to add a new checkbox item to an existing asp:checkboxlist control, when another checkbox is checked, without having to do a full postback of the page. Whether it's with javascript, jquery, ajax. Just wondering how (if at all) I can do something like this.</p> <p>I've been doing some research and it appears I can do a partial postback using an asp:UpdatePanel. I've never used one of these before. Does anyone have an example of how they can be used? Here's what I have, but it's still doing a full postback</p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;tr&gt; &lt;td width="50%"&gt; &lt;asp:CheckBox runat="server" ID="chkEnglish" Font-Bold="true" TextAlign="Right" Text=" English" /&gt; &lt;/td&gt; &lt;asp:Panel runat="server" ID="pnlTopLanguages"&gt; &lt;td rowspan="3" valign="top"&gt; &lt;asp:CheckBoxList ID="chkTopLanguages" CssClass="cb chkTopLangs" TextAlign="Right" runat="server" /&gt; &lt;asp:TextBox runat="server" ID="txtOtherLanguages" onkeyup="SetButtonStatus(this)" onclick="return clearLanguageSearchText()" Text="Other Languages..."&gt;&lt;/asp:TextBox&gt; &lt;asp:Button runat="server" ID="btnAddLang" Text="Add" OnClientClick="return CopyOtherLangs()" Enabled="false" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;asp:CheckBox runat="server" ID="chkManyOtherLanguages" CssClass="cb" Font-Bold="true" Text="Many other languages" /&gt; &lt;cc3:AutoCompleteExtender ID="aceSearch" runat="server" MinimumPrefixLength="1" TargetControlID="txtOtherLanguages" ServicePath="~/controls/wsCommunity.asmx" ServiceMethod="GetLanguageCompletionList"&gt;&lt;/cc3:AutoCompleteExtender&gt; &lt;/td&gt; &lt;/asp:Panel&gt; &lt;/tr&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre>
 

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