How to use the MutuallyExclusiveCheckBox key Property

Last post 07-23-2007 10:49 PM by Caturday MMXXV. 2 replies.

Sort Posts:

  • How to use the MutuallyExclusiveCheckBox key Property

    03-22-2007, 11:35 AM
    • Member
      321 point Member
    • Caturday MMXXV
    • Member since 03-21-2007, 4:02 PM
    • Youngsville LA
    • Posts 85

    Hi,

    I am trying to use the MutuallyExclusiveCheckBox but I cannot figure out how to group the Checkboxes using the key property.  I thought it would be something like a div, but that is not working. This is what I have so far

    <div id = "MyKey">
                        <asp:CheckBox ID="CheckBox1" runat="server" />
                            <asp:CheckBox ID="CheckBox2" runat="server" />
                            <asp:CheckBox ID="CheckBox3" runat="server" />
                        </div>
                        <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender1" runat="server" Key = "MyKey"
                            TargetControlID="CheckBox1">
                        </cc1:MutuallyExclusiveCheckBoxExtender>

    Ben Blanchard

    Total Disgrace - For everything awful and awfully funny.


    [Don't forget to click on Mark as answer on the post that helped you ]

  • Re: How to use the MutuallyExclusiveCheckBox key Property

    07-23-2007, 3:41 PM
    • Member
      2 point Member
    • arkaro
    • Member since 07-23-2007, 6:50 PM
    • Posts 1

    From what I understand, the control can only point to CheckBox objects.. so set up an Extender setting each TargetControlID to each checkbox.. and then use the Key to connect all the Extenders.. such as this:

    1    <div id ="CheckBoxes">
    2                        <asp:CheckBox ID="CheckBox1" runat="server" />
    4    <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender1" runat="server" Key ="MyKey" TargetControlID="CheckBox1" />
    6                            <asp:CheckBox ID="CheckBox2" runat="server" />
    8    <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender1" runat="server" Key ="MyKey" TargetControlID="CheckBox2" />
    10                           <asp:CheckBox ID="CheckBox3" runat="server" />
    12   <cc1:MutuallyExclusiveCheckBoxExtender ID="MutuallyExclusiveCheckBoxExtender1" runat="server" Key ="MyKey" TargetControlID="CheckBox3" />
    14                       </div>

     Now.. my question for someone else.. What if you want Checkbox3 to be exclusive over Checkbox1 & Checkbox2.. such as if 3 were an optout and 1&2 were optin options? We can't share checkbox ID's nor can we encapulate the exender around the options with start/end tags. The Div attempt above might seem to work, but it does not.

     Wait a minute.. ah ha! Looks like I answered my own question:
     
    1    <div id="checkBoxes">
    2        <ajax:ScriptManager ID="ScriptManager1" runat="server" />
    3        <asp:CheckBox ID="BasicCheckBox" runat="server" Checked="True" Text="LSH events & news" />
    4            <cc1:MutuallyExclusiveCheckBoxExtender ID="BasicCheckBoxEx" runat="server" TargetControlID="BasicCheckBox" Key="BasicKey" />
    5        <asp:CheckBox ID="ArticlesCheckBox" runat="server" Text="Articles of interest (other news)" />
    6            <cc1:MutuallyExclusiveCheckBoxExtender ID="ArticlesCheckBoxEx" runat="server" TargetControlID="ArticlesCheckBox" Key="ArticleKey" />
    7         <asp:CheckBox ID="ActionCheckBox" runat="server" Text="Local action alerts" />
    8        <cc1:MutuallyExclusiveCheckBoxExtender ID="ActionCheckBoxEx" runat="server" TargetControlID="ActionCheckBox" Key="ActionKey" />  
    9        <asp:CheckBox ID="EmailOptout" runat="server" OnCheckedChanged="EmailOptout_CheckedChanged" Text="Please REMOVE me from the LSH mailing list." />
    10               <cc1:MutuallyExclusiveCheckBoxExtender ID="BasicOptout" runat="server" TargetControlID="EmailOptout" Key="BasicKey" />
    11       <cc1:MutuallyExclusiveCheckBoxExtender ID="ArticlesOptout" runat="server" TargetControlID="EmailOptout" Key="ArticleKey" />
    12       <cc1:MutuallyExclusiveCheckBoxExtender ID="ActionOptout" runat="server" TargetControlID="EmailOptout" Key="ActionKey" />
    13       </div>
    
     
     
     FYI, for all the other beginners such as myself. VS2k5 had a hissy fit if I didn't add the Scriptmanager (line 2).. and I had to place it right before the checkboxes for it to work correctly. And for that to work, I had to edit my Web.config file to replace the 

    System.Web.Extensions tagprefix="asp" to tagprefix="ajax"

  • Re: How to use the MutuallyExclusiveCheckBox key Property

    07-23-2007, 10:49 PM
    • Member
      321 point Member
    • Caturday MMXXV
    • Member since 03-21-2007, 4:02 PM
    • Youngsville LA
    • Posts 85

     I was surprised to see someone respond 4 months later.  I finally got it to work, but realized that javascript would be much easier and smaller (kilobytes) than the AJAX library.

    Ben Blanchard

    Total Disgrace - For everything awful and awfully funny.


    [Don't forget to click on Mark as answer on the post that helped you ]

Page 1 of 1 (3 items)