I have a webdatagrid 4 pages of 10 rows per page. How can I set the page index to page 2?
wgData.PageIndex = newPageIndex; // would be too easy right?
Thanks
Hello jenkinsta,
In this scenario, you can set the PageIndex property of the grid's Paging behavior in order to achieve your requirement.
This may be done via the designer as described at:
http://help.infragistics.com/NetAdvantage/ASPNET/2012.2/CLR4.0/?page=WebDataGrid_Paging.html
Alternatively, the following code may be used to set the page index from the code-behind:
WebDataGrid1.Behaviors.Paging.PageIndex = 2;
Ok, I set the behaviors to page 2 before databind but when I run this it displays page 1.
WebDataGrid1.Behaviors.Paging.PageIndex = 2; WebDataGrid1.DataBind();
I am attaching a small sample for this scenario using version 12.2.20122.2031 for you. If you are using a different version some sample code or markup illustrating the setup of the grid in your scenario would be greatly appreciated and will help us examine the scenario with identical configuration. Do not hesitate to contact me if you have any additional questions.
Please do not hesitate to contact me if you need any further assistance with this scenario.
I need to change my grid's current page index in the grid's PageIndexChanged event. I have this event firing server side. My question is how do I get the grid's new page index?
Again, I want to handle this in the grid's PageIndexChanged event server side. If there's a better to accomplish this overall please let me know.
I am not sure your request makes sense as paging should work just by enabling the Paging behavior. The PageIndexChanged event lets you know that page navigation has occurred and you shouldn't need to change what the current page is in that event. You can get or set the current page using the PageIndex property off the Paging behavior:
// get int index = WebDataGrid1.Behaviors.Paging.PageIndex; // set WebDataGrid1.Behaviors.Paging.PageIndex = 1;
As far as providing a better way to accomplish this, it would help if you provided details on what behavior you are looking to accomplish if it is more than just enabling paging. If all you wanted to do is enable paging, is something not working when you enable the paging behavior.
getting what Zero value every time, not changing the value after selecting 2ed page in code. behind in asp.net