Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We Have a Bulk Data bind To Grid and The Datasource Like Datatable Store in Cache. I Want that When i Click The Button It Fill only Top 100 Record in Grid and Reset are Fill in Background.
Actaully when i Fill Whole Record in one time then it hange the screen and display white Background. i am not want to use paging in grid view according to client.
So it thier any way for fill grid view in Background So that in first time it fill 100 recods an in backgroud fill record automatically
Posted
Updated 9-May-11 20:54pm
v3
Comments
Sandeep Mewara 10-May-11 2:35am    
1. PRE tags are for code formatting.
2. Every word in a sentence does not start with a capital letter. Please edit your question and correct it.

you Cannot do that because you are working with ASP.NET GridView and until unless all data is binded the gridview won't generate its HTML to be sent to client to show.

you can use the default paging support
http://www.dotnetspider.com/resources/1249-grid-view-paging-sorting.aspx[^]

Thanks,
Hemant
 
Share this answer
 
ya we can do following way
public void bindgrid()
{
SqlDataAdapter da = new SqlDataAdapter("select * from emp1", cn);
DataTable dt = new DataTable();
da.Fill(dt);

GridView2.DataSource = dt;
GridView2.DataBind();
Session["dtEmp"] = dt;
}

protected void btnNxt_Click(object sender, EventArgs ev)
{
DataTable dtEmp = (DataTable)Session["dtEmp"];

DataView dvEmp = new DataView(dtEmp);
int currentPage = Convert.ToInt32(ViewState["currentPage"]) + 99;
dvEmp.RowFilter = "empNo > " + currentPage;

GridView2.DataSource = dvEmp;
GridView2.DataBind();

ViewState["currentPage"] = currentPage + 1;


}
in page load put
ViewState["currentPage"] = 1;
 
Share this answer
 
v2
Comments
Hemant__Sharma 10-May-11 5:28am    
which part of the code does "Fill in Background"?
what he wants is:
1- fill first 100 records and show it to user
2- when it is in front of user rest of the data is being filled in background

Thanks,
Hemant
LakshmiNarayana Nalluri 10-May-11 5:47am    
first top 100 records diplay in gridview
and then from 101 to 200 ,201 to 300 .......
without using paging

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900