Change Datagrid default display page?
-
Hi, I am having datagrid with pagesize 5 and dataset which returns 20 records and binds with datagrid. What I need is to display the datagrid by default from 2 page - that is from 6th record of my dataset result. How could i do this? Any luck. Rams.
Be simple and Be sample.
-
Hi, I am having datagrid with pagesize 5 and dataset which returns 20 records and binds with datagrid. What I need is to display the datagrid by default from 2 page - that is from 6th record of my dataset result. How could i do this? Any luck. Rams.
Be simple and Be sample.
Hi, dg.CurrentPageIndex = 2; dg.DataBind();
Thanks and Regards, Chetan Ranpariya
-
Hi, dg.CurrentPageIndex = 2; dg.DataBind();
Thanks and Regards, Chetan Ranpariya
-
Thanks, When i change currentpageindex, then I can't go to previous page. How to get rid of it.
Be simple and Be sample.
Make sure you handle the event PageIndexChanged for datagrid. Set DataGrid.CurrentPageIndex = e.NewPageIndex; Hope this works :)
-
Thanks, When i change currentpageindex, then I can't go to previous page. How to get rid of it.
Be simple and Be sample.
Hi, Can you post your code of GridBinding and PageIndexChangedEvent ?
Thanks and Regards, Chetan Ranpariya
-
Hi, Can you post your code of GridBinding and PageIndexChangedEvent ?
Thanks and Regards, Chetan Ranpariya
In the PageIndexChanged Event Write
DataGrid.CurrentPageIndex = e.NewPageIndex; //Bind DataGrid with DataSource //Use the same code which you used to bind the data initially...
-
Hi, I am having datagrid with pagesize 5 and dataset which returns 20 records and binds with datagrid. What I need is to display the datagrid by default from 2 page - that is from 6th record of my dataset result. How could i do this? Any luck. Rams.
Be simple and Be sample.
-
Thanks, When i change currentpageindex, then I can't go to previous page. How to get rid of it.
Be simple and Be sample.
Hi, I have done this thing by following way and it works fine for me. I Page_Load i have writen the following to bind my datagrid for the fist time. if(!isPostBack) { dgSearchResult.CurrentPageIndex = 1; // This will show 2nd page initially as u wanted to. dgSearchResult.DataSource = dst.Tables["Products"]; dgSearchResult.DataBind(); } and in PageIndexChanged event of datagrid I have written the following code. dgSearchResult.CurrentPageIndex = e.NewPageIndex; dgSearchResult.DataSource = dst.Tables["Products"]; dgSearchResult.DataBind(); I hope this will help you.
Thanks and Regards, Chetan Ranpariya