Page index change for large gridview that has huge dataOSOsama Shatnawe12yAsked Aug 30, 2014, 4:26 AM EDT3 answersShareLinkedInXCopy linkSaveHi, I would like to ask you for a method to page index change for large gridview that has large data becouse the page index change of this grid is so slow. Thanks.3 AnswersKnow the answer? Post it. Somebody with the same question will find it here.Vasanth Krishnan101 points12y agoPosted Aug 31, 2014, 11:11 PM EDT+1Can you please let me know whether that is the normal asp grid view or some other third party grid view.+1OSOsama Shatnawe2 points12y agoPosted Sep 1, 2014, 3:05 AM EDT0yes it's a normal asp.net gridview0Vasanth Krishnan101 points12y agoPosted Sep 1, 2014, 4:20 AM EDT0Try this one and let me know the result.Add this method in the asp:Grid in aspx page//Add OnPageIndexChanging and PageSize="30" as shown below.<asp:GridView OnPageIndexChanging="gvProduct_PageIndexChanging" PagerStyle-ForeColor="#ffab66" runat="server" ShowHeader="true" AllowPaging="true" PagerSettings-Position="TopAndBottom" PagerStyle-Font-Bold="true" PageSize="30" PagerStyle-HorizontalAlign="Right" AutoGenerateColumns="False" CellPadding="1" Font-Bold="False" Font-Names="Arial, Helvetica, sans-serif" Font-Size="12px"> <PagerStyle CssClass="pager" /> <PagerSettings Position="TopAndBottom"></PagerSettings> <Columns> </Columns> </asp:GridView>//Add this line in the code behindprotected void gvProduct_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e) { string sMonth = ddlMonth.SelectedItem.Value; string sYear = ddlYear.SelectedItem.Value; try { string sCompanyCode = Session["CompanyCode"].ToString(); ds = new DataSet(); dt = new System.Data.DataTable(); //Retrieve the data set and assign it to data table gvEmployee.PageIndex = e.NewPageIndex; gvEmployee.DataSource = dt; gvEmployee.DataBind(); } catch (Exception ex) { } finally { clsCommon.CloseDB(); } }I just give u the idea. Please try this and let me know the status if u wish.Thanks0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign in
Page index change for large gridview that has huge dataOSOsama Shatnawe12yAsked Aug 30, 2014, 4:26 AM EDT3 answersShareLinkedInXCopy linkSaveHi, I would like to ask you for a method to page index change for large gridview that has large data becouse the page index change of this grid is so slow. Thanks.
Vasanth Krishnan101 points12y agoPosted Aug 31, 2014, 11:11 PM EDT+1Can you please let me know whether that is the normal asp grid view or some other third party grid view.+1
Vasanth Krishnan101 points12y agoPosted Sep 1, 2014, 4:20 AM EDT0Try this one and let me know the result.Add this method in the asp:Grid in aspx page//Add OnPageIndexChanging and PageSize="30" as shown below.<asp:GridView OnPageIndexChanging="gvProduct_PageIndexChanging" PagerStyle-ForeColor="#ffab66" runat="server" ShowHeader="true" AllowPaging="true" PagerSettings-Position="TopAndBottom" PagerStyle-Font-Bold="true" PageSize="30" PagerStyle-HorizontalAlign="Right" AutoGenerateColumns="False" CellPadding="1" Font-Bold="False" Font-Names="Arial, Helvetica, sans-serif" Font-Size="12px"> <PagerStyle CssClass="pager" /> <PagerSettings Position="TopAndBottom"></PagerSettings> <Columns> </Columns> </asp:GridView>//Add this line in the code behindprotected void gvProduct_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e) { string sMonth = ddlMonth.SelectedItem.Value; string sYear = ddlYear.SelectedItem.Value; try { string sCompanyCode = Session["CompanyCode"].ToString(); ds = new DataSet(); dt = new System.Data.DataTable(); //Retrieve the data set and assign it to data table gvEmployee.PageIndex = e.NewPageIndex; gvEmployee.DataSource = dt; gvEmployee.DataBind(); } catch (Exception ex) { } finally { clsCommon.CloseDB(); } }I just give u the idea. Please try this and let me know the status if u wish.Thanks0
Vasanth Krishnan101 pointsPosted Aug 31, 2014, 11:11 PM EDT
Osama Shatnawe2 pointsPosted Sep 1, 2014, 3:05 AM EDT
Vasanth Krishnan101 pointsPosted Sep 1, 2014, 4:20 AM EDT
Add this method in the asp:Grid in aspx page
//Add OnPageIndexChanging and PageSize="30" as shown below.
<asp:GridView OnPageIndexChanging="gvProduct_PageIndexChanging" PagerStyle-ForeColor="#ffab66" runat="server" ShowHeader="true" AllowPaging="true"
PagerSettings-Position="TopAndBottom" PagerStyle-Font-Bold="true" PageSize="30"
PagerStyle-HorizontalAlign="Right" AutoGenerateColumns="False" CellPadding="1"
Font-Bold="False" Font-Names="Arial, Helvetica, sans-serif" Font-Size="12px">
<PagerStyle CssClass="pager" />
<PagerSettings Position="TopAndBottom"></PagerSettings>
<Columns>
</Columns>
</asp:GridView>
//Add this line in the code behind
protected void gvProduct_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e)
{
string sMonth = ddlMonth.SelectedItem.Value;
string sYear = ddlYear.SelectedItem.Value;
try
{
string sCompanyCode = Session["CompanyCode"].ToString();
ds = new DataSet();
dt = new System.Data.DataTable();
//Retrieve the data set and assign it to data table
gvEmployee.PageIndex = e.NewPageIndex;
gvEmployee.DataSource = dt;
gvEmployee.DataBind();
}
catch (Exception ex)
{
}
finally
{
clsCommon.CloseDB();
}
}
I just give u the idea. Please try this and let me know the status if u wish.
Thanks