Home > DeveloperSection > Articles > Ajax Toolkit MutuallyExclusiveCheckBox Extender Control in ASP.Net

Ajax Toolkit MutuallyExclusiveCheckBox Extender Control in ASP.Net


AJAX AJAX 
Ratings:
0 Comment(s)
 5681  View(s)
Rate this:

Ajax Toolkit MutuallyExclusiveCheckBox Extender Control in ASP.Net

MutuallyExclusiveCheckBox is an ASP.NET AJAX extender that can be attached to any ASP.NET CheckBox control. By adding a number of checkboxes to the same "Key", only one checkbox with the specified key can be checked at a time. This extender is useful when a number of choices are available but only one can be chosen.

MutuallyExclusiveCheckBox Properties:

TargetControlID - The ID of the CheckBox to modify

Key - The unique key to use to associate checkboxes. This key does not respect INamingContainer renaming.

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 toolkit--%>

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

<%-- Add three MutuallyExclusiveCheckbox which control the three checkbox--%>

 

<cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender1" runat="server" TargetControlID="CheckBox1" Key="pl">

</cc1:MutuallyExclusiveCheckBoxExtender>

 

<cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender2" runat="server" TargetControlID="CheckBox2" Key="pl">

</cc1:MutuallyExclusiveCheckBoxExtender>

 

<cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender3" runat="server" TargetControlID="CheckBox3" Key="pl">

</cc1:MutuallyExclusiveCheckBoxExtender>

 

<asp:Label ID="Label1" runat="server" Text="Select Programming Language">

</asp:Label>

<br />

<asp:CheckBox ID="CheckBox1" runat="server" Text="C#" />

<asp:CheckBox ID="CheckBox2" runat="server" Text="J#" />

<asp:CheckBox ID="CheckBox3" runat="server" Text="VB" />

Here Key="pl" will be same for all the checkbox which I want to be in a group.

 

Run the project

AjaxControl Toolkit MutuallyExclusiveCheckBox Extender Control in ASP.Net

Select any one language

AjaxControl Toolkit MutuallyExclusiveCheckBox Extender Control in ASP.Net

When you select other language then first one will be unselected.

AjaxControl Toolkit MutuallyExclusiveCheckBox Extender Control in ASP.Net


Don't want to miss updates? Please click the below button!

Follow MindStick