I have a checkbox that, when clicked, checks or un-checks all the checkboxes that exists in a Telerik RadGrid.
function CheckAll(sender, args) {
// Set all the checkboxes according to the master
$(":checkbox").attr("checked", sender.get_checked());
// If "check all", do some other stuff
if(sender.get_checked())
{
var masterTable = $find("<%=gridSubmittedRequests.ClientID%>").get_masterTableView();
var rows = masterTable.get_dataItems(); // row collection
// do some other stuff
}
}
}
This all works fine until I open (and close) a jquery dialog, after which
$find("<%=gridSubmittedRequests.ClientID%>")
returns null. Hence, I can never get to the important // do some other stuff part.
The jQuery dialog close function doesn’t do anything special:
$("#divProcessModal").dialog(
{
height: 300,
width: 400,
modal: true,
resizable: false,
buttons: {
"Process request(s)": function (e) {
// process requests
},
"Close without processing": function (e) {
$(this).dialog("close");
e.preventDefault();
}
},
title: "Process Request(s)",
});
All I do is click the Close without processing button.
Things I’ve tried include registering the script on the server side, and setting the mastertable as a global variable, but without success.
Update
I figured out what the cause is. The content of the jquery dialog is another page
$("#divProcessModal").load("/ProcessRequests.aspx?requestList="+requestList);
This page has its own form, code-behind and all that, and that seems to cause the problem. I guess I can move all the functionality in ProcessRequests.aspx to the current aspx page, but if anyone can explain what is happening and why my initial approach doesn’t work, I would appreciate it.
I figured out what the cause is. The content of the jquery dialog is another page
$("#divProcessModal").load("/ProcessRequests.aspx?requestList="+requestList);This page has its own form, code-behind and all that, and that seems to cause the problem. Moving all the functionality in ProcessRequests.aspx to the current aspx page solves the problem.