Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting Startedjquery checkboxjquery checkbox
Previous
 
Next
New Post
7/13/2011 3:40 PM
 
Am using the following code to check/uncheck all checkboxes in a list.  The code works fine and the text is updated, however, the checkbox that is causing the toggle does not stay checked.  It is always unchecked.  If I add an alert to the first function in the toggle, I can see that the box is checked.  After selecting OK, the box is unchecked.  Any idea why this is happening or what I can do to get the cbCheckall.Checked property to toggle properly as well?

<script type="text/javascript">
    $(document).ready(function () {
        $("#" + document.getElementById('<%= Me.cb1.ClientID %>').attributes.getNamedItem("ID").nodeValue).toggle(
            function () {
                $("input[id*=" + document.getElementById('<%= Me.userControl.FindControl("cbl1").ClientID %>').attributes.getNamedItem('ID').nodeValue + "]").attr('checked', 'checked');
                $("#" + document.getElementById('<%= Me.cb1.ClientID %>').attributes.getNamedItem("ID").nodeValue).next("label").text("(Unselect All)");
            },
            function () {
                $("input[id*=" + document.getElementById('<%= Me.userControl.FindControl("cbl1").ClientID %>').attributes.getNamedItem('ID').nodeValue + "]").removeAttr('checked');
                $("#" + document.getElementById('<%= Me.cb1.ClientID %>').attributes.getNamedItem("ID").nodeValue).next("label").text("(Select All)");
            });
    });
</script>

All help is greatly appreciated!


Bub
 
New Post
7/14/2011 8:05 AM
 
btw... the cbCheckAll is actually cb1 in the code.

Does this make sense, is more explanation required?

Thanks,
Bub

Bub
 
New Post
7/19/2011 5:13 PM
 
Any help available?

Bub
 
New Post
7/24/2011 1:49 AM
 
<body>
<form id="form1" runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server">
    <Scripts>
      <asp:ScriptReference Path="http://ajax.aspnetcdn.com/ajax/jQuery..." />
    </Scripts>
  </asp:ScriptManager>
  <div>
    <input type="checkbox" id="trigger" class="trigger" />
    <label for="trigger" class="toggled">Select All</label>
    <label for="trigger" class="toggled" style="display: none">Unselect All</label>
    <asp:CheckBoxList ID="CheckBoxList1" runat="server" CssClass="options">
      <asp:ListItem>Item 1</asp:ListItem>
      <asp:ListItem>Item 2</asp:ListItem>
      <asp:ListItem>Item 3</asp:ListItem>
      <asp:ListItem>Item 4</asp:ListItem>
    </asp:CheckBoxList>
  </div>
</form>
<script type="text/javascript">
  $(function () {
        $('#trigger').change(function () {
                $('.toggled').toggle();
                $('.options input[type=checkbox]').removeAttr('checked');
                if ($(this).is(':checked'))
                                $('.options input[type=checkbox]').attr('checked', 'checked');
        });
  });
</script>
</body>

 
New Post
7/25/2011 9:21 AM
 
I have tried several methods like that, though to no avail.  Am wondering if it is because of DNN.  Putting a pause shows the box is immediately checked, though when the query is finished running, it is un-chcecked.  At full speed, cannot see that anything is happening.

Bub
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting Startedjquery checkboxjquery checkbox


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out