'string'不包含'ClientID'的定义,也没有扩展方法'ClientID'

时间:2015-06-03 09:41:12

标签: c# jquery asp.net

  

'string'不包含'ClientID'的定义,并且没有扩展方法'ClientID'接受类型'string'的第一个参数可以找到(你是否缺少using指令或汇编引用?)

$('.close-modal').click(function (e) {
    $('.modal, .modal-backdrop').fadeOut('fast');
    //Storing Id of the grids in an array
    var gridId = ["GridMyMeeting", "GridAllMeeting", "GridMyMeeting"];

    //Using setTimeout in for loop to rebind grid data at the same time
    for (var i = 0; i < gridId.length; i++) {
        window.setTimeout($find("<% =" + gridId[i]+ ".ClientID %>").get_masterTableView().rebind(), 10);
    }
});

1 个答案:

答案 0 :(得分:0)

您应该创建ClientID数组,然后直接使用gridId[i]

var gridId = ["<% = GridMyMeeting.ClientID %>", "<% = GridAllMeeting.ClientID %>"];

for (var i = 0; i < gridId.length; i++) {
    window.setTimeout(function() {
        $find(gridId[i]).get_masterTableView().rebind();
    }, 10);
}