I have jquery code that allows a user to select all the checkboxes in a checkboxlist with another checkbox. It works fine. But when I use the cascading dropdownlist it stops working for some reason. Any help would be really appreciated. I have a copy of
the jquery code below and I just use the ajax toolkit dropdownlist which is connected to a webservice. But the cascading works fine.
Regards,
Seamus
$(document).ready(function () {
$("#<%=ulsterSelectAllCheckbox.ClientID %>").click(function () {
$("#<%= ulsterCheckboxlist.ClientID %> input:checkbox").attr('checked', this.checked);
});
$("#<%=ulsterCheckboxlist.ClientID %> input:checkbox").click(function () {
if ($("#<%= ulsterSelectAllCheckbox.ClientID %>").attr('checked') == true && this.checked == false)
$("#<%= ulsterSelectAllCheckbox.ClientID %>").attr('checked', false);
if (this.checked == true)
CheckSelectAll();
});
function CheckSelectAll() {
var flag = true;
$("#<%=ulsterCheckboxlist.ClientID %> input:checkbox").each(function () {
if (this.checked == false)
flag = false;
});
$("#<%= ulsterSelectAllCheckbox.ClientID %>").attr('checked', flag);
}
});
Controls in AJAX control toolkits can be considered loaded in an asynchronous manner. That is to say even when full page's html is loaded, controls of ACT may not be loaded yet. So when you use document.ready() to find DOMs that is related to AJAX control
toolkit, it may not be successful.
Controls in AJAX control toolkits can be considered loaded in an asynchronous manner. That is to say even when full page's html is loaded, controls of ACT may not be loaded yet. So when you use document.ready() to find DOMs that is related to AJAX control
toolkit, it may not be successful.
Thanks for the reply. So do you think if I don't use document.ready() and assign the event in the definition of the control that it will work in jquery and or javascript?
To my understanding you are having your checkbox and dropdownlist inside an update panel and you are using selected index changed of the ddl(autopostback="true"). That is causing the problem. Try this approach-
seamus1982
Participant
936 Points
375 Posts
JQuery Code not working properly after cascading dropdownlist is used
Jan 16, 2012 02:30 PM|LINK
Hi,
I have jquery code that allows a user to select all the checkboxes in a checkboxlist with another checkbox. It works fine. But when I use the cascading dropdownlist it stops working for some reason. Any help would be really appreciated. I have a copy of the jquery code below and I just use the ajax toolkit dropdownlist which is connected to a webservice. But the cascading works fine.
Regards,
Seamus
$(document).ready(function () { $("#<%=ulsterSelectAllCheckbox.ClientID %>").click(function () { $("#<%= ulsterCheckboxlist.ClientID %> input:checkbox").attr('checked', this.checked); }); $("#<%=ulsterCheckboxlist.ClientID %> input:checkbox").click(function () { if ($("#<%= ulsterSelectAllCheckbox.ClientID %>").attr('checked') == true && this.checked == false) $("#<%= ulsterSelectAllCheckbox.ClientID %>").attr('checked', false); if (this.checked == true) CheckSelectAll(); }); function CheckSelectAll() { var flag = true; $("#<%=ulsterCheckboxlist.ClientID %> input:checkbox").each(function () { if (this.checked == false) flag = false; }); $("#<%= ulsterSelectAllCheckbox.ClientID %>").attr('checked', flag); } });bruce (sqlwo...
All-Star
36656 Points
5438 Posts
Re: JQuery Code not working properly after cascading dropdownlist is used
Jan 16, 2012 09:03 PM|LINK
i would not mix the ajax toolkit with jquery or the update panel. use a jquery cascade dropdown.
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: JQuery Code not working properly after cascading dropdownlist is used
Jan 18, 2012 04:42 AM|LINK
Hello
Controls in AJAX control toolkits can be considered loaded in an asynchronous manner. That is to say even when full page's html is loaded, controls of ACT may not be loaded yet. So when you use document.ready() to find DOMs that is related to AJAX control toolkit, it may not be successful.
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
seamus1982
Participant
936 Points
375 Posts
Re: JQuery Code not working properly after cascading dropdownlist is used
Jan 18, 2012 08:44 AM|LINK
Thanks for the reply. So do you think if I don't use document.ready() and assign the event in the definition of the control that it will work in jquery and or javascript?
asteranup
All-Star
30184 Points
4906 Posts
Re: JQuery Code not working properly after cascading dropdownlist is used
Jan 18, 2012 09:20 AM|LINK
Hi,
To my understanding you are having your checkbox and dropdownlist inside an update panel and you are using selected index changed of the ddl(autopostback="true"). That is causing the problem. Try this approach-
http://forums.asp.net/p/1744419/4710297.aspx/1?Re+How+to+Avoid+partial+postback+when+clicked+on+a+jquery+confirm+dialogue+box+NO+button+
Or use add_endRequest like this-
http://forums.asp.net/p/1712138/4560580.aspx/1?Re+jQuery+fancybox+not+working+on+DataList+Pageindex+changed
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
seamus1982
Participant
936 Points
375 Posts
Re: JQuery Code not working properly after cascading dropdownlist is used
Jan 18, 2012 10:13 AM|LINK
Thanks for the replies. Asteranup that worked perfectly. Thanks a million.
Regards,
Seamus