articles

Home / DeveloperSection / Articles / Ajax Toolkit ToggleButtonExtender Control in ASP.Net

Ajax Toolkit ToggleButtonExtender Control in ASP.Net

Pushpendra Singh18156 05-Dec-2010

ToggleButton is an ASP.NET AJAX extender that can be attached to an ASP.NET CheckBox control. ToggleButton enables the use of custom images instead of tick mark in the CheckBox. The behaviour of the CheckBox is unaffected.

ToggleButton Properties:

TargetControlID - The ID of the CheckBox to modify

Image Height\Image Width - The height and width of the image

CheckedImageUrl - the URL of the image to show when the toggle button is in the checked state.

UncheckedImageUrl - the URL of the image to show when the toggle button is in the unchecked state.

Code:

 <%-- ScriptManager control manages client script for AJAX enabled ASP.NET pages.This enables partial-page rendering and Web-service calls.You have to used this if you want to use ajax control--%>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
 
<%--Add the togglebuttonextender and one checkbox--%>
<cc1:ToggleButtonExtender ID="ToggleButtonExtender1" runat="server" TargetControlID="CheckBox1" UncheckedImageUrl="~/Unchecked.png"
CheckedImageUrl="~/Checked.png" ImageHeight="60" ImageWidth="60">
</cc1:ToggleButtonExtender>
 
<asp:CheckBox ID="CheckBox1" runat="server" Text="Do you want to select?" />

Run the project

Images hide the checkboxes to show the checked and unchecked state.

Ajax Toolkit ToggleButtonExtender Control in ASP.Net

 

Ajax Toolkit ToggleButtonExtender Control in ASP.Net


Updated 07-Sep-2019

Leave Comment

Comments

Liked By