Gridview列调整updatepanel的问题

时间:2013-10-17 10:11:03

标签: c# jquery asp.net

我想为asp.net gridview自动调整列功能。我正在使用colResizable-1.3.min.js 用于列调整大小功能及其工作正常。但是当我尝试使用更新面板添加gridview时,jquery不起作用。它只是处理回发请求。

由于

1 个答案:

答案 0 :(得分:0)

   <script>
   //On Page Load
        $(function () {
             $('#<%=gvInv_ReceiveVoucherItem.ClientID %>').colResizable({
                liveDrag: true,
                gripInnerHtml: "<div class='grip'></div>",
                draggingClass: "dragging",
                postbackSafe: true,
                partialRefresh: true              
        });
        });

    //On UpdatePanel Refresh
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm != null) {
        prm.add_endRequest(function (sender, e) {
            if (sender._postBackSettings.panelsToUpdate != null) {
                $('#<%=gvInv_ReceiveVoucherItem.ClientID %>').colResizable({
                    liveDrag: true,
                    gripInnerHtml: "<div class='grip'></div>",
                    draggingClass: "dragging",
                    postbackSafe: true,
                    partialRefresh: true
                });
            }
        });
    };
</script>    

                                                                      

      </Columns>                             
                        </asp:GridView>
                    </asp:Panel>