如何解决Sys.InvalidOperationException:具有相同id的两个组件无法添加到应用程序中?

时间:2012-09-12 05:51:15

标签: asp.net jquery jquery-plugins

我已经将jquery数据表插件实现到gridview。它在整页加载时工作正常。 在ajax更新面板内发生的部分页面加载期间,jquery数据表功能(如分页和标题排序)对gridview工作正常,但jquery数据表css未应用,但IE浏览器抛出Sys.InvalidOperationException:2的错误具有相同id的组件ctl00_ctl00_ph1_phGrid_RequestGridView1_RequestSecurityGridView_ctl1_ctl1无法添加到应用程序中。 我浏览了视图源,但没有找到两个具有相同ID的组件。 我写的代码是

    function pageLoad(sender, args)
     {
      if(args.get_isPartialLoad())
       {
        $(document).ready( function () {
          $('#<%=RequestSecurityGridView.ClientID%>').prepend( $("<thead></thead>").append( $(this).find("tr:first") ) ).dataTable( 
           {
            "bLengthChange": false,
            "bJQueryUI": true,
            "iDisplayLength": 8,
            "sPaginationType": "full_numbers"
        } );
      } );  
     }
    else
    {
    $(document).ready( function () 
{
          $('#<%=RequestSecurityGridView.ClientID%>').prepend( $("<thead></thead>").append( $(this).find("tr:first") ) ).dataTable( 
           {
            "bLengthChange": false,
            "iDisplayLength": 8,
            "sPaginationType": "full_numbers"
        } );
      } );  
}

}
请建议我如何解决这个问题。感谢

0 个答案:

没有答案