0

我有一个复选框,单击该复选框时,会选中或取消选中 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                
        }
    }
}

这一切正常,直到我打开(和关闭)一个 jquery 对话框,之后

$find("<%=gridSubmittedRequests.ClientID%>")

返回空值。因此,我永远无法达到重要的// do some other stuff部分。

jQuery 对话框关闭函数没有做任何特别的事情:

$("#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)",
        });

我要做的就是点击Close without processing按钮。
我尝试过的事情包括在服务器端注册脚本,并将主表设置为全局变量,但没有成功。

更新

我弄清楚原因是什么。jquery对话框的内容是另一个页面

$("#divProcessModal").load("/ProcessRequests.aspx?requestList="+requestList);

这个页面有它自己的形式,代码隐藏等等,这似乎是导致问题的原因。我想我可以将所有功能ProcessRequests.aspx移到当前的 aspx 页面中,但如果有人能解释发生了什么以及为什么我的初始方法不起作用,我将不胜感激。

4

1 回答 1

0

我弄清楚原因是什么。jquery对话框的内容是另一个页面

$("#divProcessModal").load("/ProcessRequests.aspx?requestList="+requestList); 这个页面有它自己的形式,代码隐藏等等,这似乎是导致问题的原因。将 ProcessRequests.aspx 中的所有功能移动到当前的 aspx 页面可以解决问题。

于 2012-12-29T01:58:35.197 回答