I have an ASP.net gridview with bootstrap 3 styles applied and its inside an Update panel. When I bind the grid It takes more than a minute to load but the actual SP takes just 3 sec to load data. Is there any way I could speedup the databind
C#
DataSet ds = GetSearchResults(grdattendee_search.PageIndex);
Session["attendee"] = ds.Tables[0];
grdattendee_search.DataSource = ds.Tables[0];
grdattendee_search.DataBind();
protected void grdattendee_search_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdattendee_search.PageIndex = e.NewPageIndex;
if (Session["attendee"] != null)
{
grdattendee_search.DataSource = Session["attendee"];
grdattendee_search.DataBind();
}
else
bindgrid();
}
Aspx
<asp:GridView ID="grdattendee_search" runat="server" AllowPaging="true" PageSize="10"
AutoGenerateColumns="false" CssClass="table table-hover" DataKeyNames="ID"
GridLines="Horizontal" BorderStyle="None" PagerStyle-CssClass="bs-pagination"
OnRowCommand="grdattendee_search_RowCommand" OnPageIndexChanging="grdattendee_search_PageIndexChanging">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID"
Visible="false" />
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<ItemTemplate>
<%-- <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Name")%>'></asp:HyperLink>--%>
<asp:LinkButton ID="btn" runat="server" CommandName="select" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
Text='<%# string.Concat(Eval("name_first"), " ", Eval("name_last"))%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Degree" HeaderText="Degree" SortExpression="Degree" />
<asp:BoundField DataField="specialty" HeaderText="Specialty" SortExpression="specialty" />
<asp:BoundField DataField="city" HeaderText="City" SortExpression="city" />
<asp:BoundField DataField="state" HeaderText="State" SortExpression="state" />
</Columns>
</asp:GridView>
Identified the issue. The issue is not with the binding. Another process in the page load is blocking the current data binding.