Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Please refer to the following example which demonstrates in javascript how to:</p> <ul> <li>Get the state of a togglebuttonextender,</li> <li>Change the state of a togglebuttonextender, and</li> <li><p>Set the togglebuttonextender to false.</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %&gt; &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript"&gt; function getcheckstate() { var e = $find("tb"); alert(e._element.checked); } function change() { var e = $find("tb"); e._element.click(); //e._element.checked = (!e._element.checked); // &lt;--- Dont use this method because it requires you hover your mouse over the image in order for it to update. } function changetofalse() { var e = $find("tb"); if (e._element.checked) e._element.click(); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt; &lt;asp:CheckBox ID="CheckBox1" runat="server" /&gt; &lt;asp:ToggleButtonExtender ID="tbe" TargetControlID="CheckBox1" ImageWidth="22" ImageHeight="22" CheckedImageUrl="http://findicons.com/files/icons/1050/pidgin_old_tango_smilies/24/good.png" UncheckedImageUrl="http://findicons.com/files/icons/1050/pidgin_old_tango_smilies/24/bad.png" runat="server" BehaviorID="tb" /&gt; &lt;br /&gt;&lt;br /&gt; &lt;input type="button" onclick="getcheckstate()" value="Get Checkbox Checked State" /&gt; &lt;br /&gt; &lt;input type="button" onclick="change()" value="Change Checkbox Checked State" /&gt; &lt;br /&gt; &lt;input type="button" onclick="changetofalse()" value="Set Checkbox Checked State To False" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre></li> </ul>
    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. This table or related slice is empty.
    1. This table or related slice is empty.
    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