paging & sorting in gridview
-
hi how to implement paging & sorting in gridview...both r working but if my page size is 20 and records r 60 then the sorting done on 60 records insted of 20 record of current page... i have tried like this public DataSet GetDatasetForPage(DataSet dsGlobal, int pageindex, int pagesize) { string Query = "Select * From tb where Deleted!=1"; SqlConnection myConnection = dbAccess.SQLConn; dsGlobal.Tables[0]. SqlDataAdapter dapter = new SqlDataAdapter(Query,myConnection); dapter.Fill(dsGlobal, pageindex, pagesize, "tb"); return (dsGlobal); } but i don't want to execute select statement each and every time...
Jintal Patel
-
hi how to implement paging & sorting in gridview...both r working but if my page size is 20 and records r 60 then the sorting done on 60 records insted of 20 record of current page... i have tried like this public DataSet GetDatasetForPage(DataSet dsGlobal, int pageindex, int pagesize) { string Query = "Select * From tb where Deleted!=1"; SqlConnection myConnection = dbAccess.SQLConn; dsGlobal.Tables[0]. SqlDataAdapter dapter = new SqlDataAdapter(Query,myConnection); dapter.Fill(dsGlobal, pageindex, pagesize, "tb"); return (dsGlobal); } but i don't want to execute select statement each and every time...
Jintal Patel
The alternative to doing the select every time is having all your records, unpaged, in viewstate. That is a nightmare, you don't want that.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )