Asp.net Grid view Fill Bulk Data in background and show some records only without using paging

Lakn2
Posted by Lakn2 under ASP.NET category on | Points: 40 | Views : 3615
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindgrid();
ViewState["currentPage"] = 1;
}
}

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;

}

Comments or Responses

Posted by: T.saravanan on: 5/10/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi,

Kindly post your code inside the code tag.
Posted by: Lakn2 on: 7/12/2011 Level:Starter | Status: [Member] | Points: 10
hi Saravanan i had updated my code in code tag.
Posted by: T.saravanan on: 7/12/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi Lakn2,

Thanks for your response.

Login to post response