Ajax controltoolkit Learning Log-mutuallyexclusivecheckboxextender (17)

Source: Internet
Author: User
The mutuallyexclusivecheckboxextender control is used to select a project so that only one project can be selected. If it is not possible, you can also choose not.
See an example below:

1) Create an ASP. NET Ajax-enabled web project in vs2005 and name it mutuallyexculsivecheckboxextender1.

2) drag and drop four checkpoints on the page and set their IDs to checkbox1, checkbox2, checkbox3, and checkbox4 respectively. Set the text to bedroom, bedroom, door, and door.

CodeAs follows: 1 < BR />
2 Do & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
3 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
4 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp; Don't < BR />
5 < BR />
6 < ASP: checkbox ID = "Checkbox1" Text = "Bedroom" Runat = "Server"   />
7 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
8 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
9 < ASP: checkbox ID = "Checkbox2" Text = "Bedroom" Runat = "Server"   />
10 < BR />
11 < BR />
12 < ASP: checkbox ID = "Checkbox3" Runat = "Server" Text = "Door"   />
13 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
14 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
15 < ASP: checkbox ID = "Checkbox4" Runat = "Server" Text = "Door"   /> < BR />
16 < BR />


3) drag and drop four mutuallyexculsivecheckboxextender controls on the page and associate them with checkbox1, checkbox2, checkbox3, and checkbox4. And set some attributes.

The Code is as follows: 1 < C0: mutuallyexclusivecheckboxextender ID = "Mutuallyexclusivecheckboxextender1" Targetcontrolid = "Checkbox1" Key = "Bedroomcheckbox" Runat = "Server" >
2 </ C0: mutuallyexclusivecheckboxextender >
3 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
4 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
5 & Nbsp;   & Nbsp;   & Nbsp;   & Nbsp;
6 < C0: mutuallyexclusivecheckboxextender ID = "Mutuallyexclusivecheckboxextender2" Targetcontrolid = "Checkbox2" Key = "Bedroomcheckbox" Runat = "Server" >
7 </ C0: mutuallyexclusivecheckboxextender >
8 < BR />
9 < C0: mutuallyexclusivecheckboxextender ID = "Mutuallyexclusivecheckboxextender3" Targetcontrolid = "Checkbox3" Key = "Doorcheckbox" Runat = "Server" >
10 </ C0: mutuallyexclusivecheckboxextender >
11 < BR />
12 < C0: mutuallyexclusivecheckboxextender ID = "Mutuallyexclusivecheckboxextender4" Targetcontrolid = "Checkbox4" Key = "Doorcheckbox" Runat = "Server" >
13 </ C0: mutuallyexclusivecheckboxextender >

Attribute description:
Targetcontrolid: the checkbox associated with the control.
Key: this unique key is used to associate several checkboxes, so that these checkboxes can have at most one choice or not.

4) press Ctrl + F5 to view the effect in the browser.

This is as follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.