data source does not support server-side data paging uisng asp.net Csharp
- by Aamir Hasan
Yesterday
some one mail me and ask about data source does not support server side
data paging.So i write the the solution here please if you have got
this problem read this article and see the example code this will help
you a Lot.The only change you have to do is in the DataBind().Here
you have used the SqlDataReader to read data retrieved from the
database, but SqlDataReader is forward only. You can not traverse back
and forth on it.So the solution for this is using DataAdapter and
DataSet.So your function may change some what like this
private void DataBind(){//for grid viewSqlCommand cmdO;string SQL = "select * from TABLE ";conn.Open();cmdO = new SqlCommand(SQL, conn);SqlDataAdapter da = new SqlDataAdapter(cmdO);DataSet ds = new DataSet();da.Fill(ds);GridView1.Visible = true;GridView1.DataSource = ds;GridView1.DataBind();ds.Dispose();da.Dispose();conn.Close();}
This
surely works. The reset of your code is fine. Enjoy coding.