Wednesday, March 16, 2011

How to show a heavy-data gridview not in page load, to prevent freezing page?

 -          Put gridview into a Update panel
<asp:UpdatePanel ID="UpdatePanelMemberList" runat="server" UpdateMode="Conditional">
    <contenttemplate>
         <asp:GridView  runat="server"/>
    </contenttemplate>
</asp:UpdatePanel>
 -          Add a hidden field to let client side javascript to click button for showing  gridview
 <asp:HiddenField ID="H1" runat="server" />
 
 
-         
After page loaded in html trigger button click
event
    $(document).ready(function () {
        var hidenv = $("#<%=H1.ClientID %>").val();
        if (hidenv != 'show'return;
         $("#<%=Submit.ClientID %>").trigger('click');
    });

No comments:

Post a Comment