Customizing xamWebGrid Paging Template

Learn to customize the xamWebGrid paging template. See how to add controls to the template and how to use the Infragistics Silverlight Commanding Framework to power common paging behaviors.

Duration: 15:10

Download

Anonymous
  • The vedio is very nice, you have explained the basic stuff nicely. I have one question in Pagination. I want to Load the Grid on demand. So basically I will not be binding the whole data to Grid at once. First I will get the 10 records from the server and will display it in the Grid. Consider the Page size is 10 and actually total record is 150 (Which is in the databse but it is not there in the Grid) so the total no of page is 15. But in UI i have only 10 records and 1 page, So grid will display 10 records with Page no 1 and remaining page number are disabled and Prev and Next button image are also disabled which is basically right since we have only 10 records in the Grid.

    But I want to do the ondemand loading, I want enable all the Pager button controls like prev, Next, Last, first and 1 to 10. and on click of say next button I will get the data from the server and will display it in the Grid.I would like to know how this can be done. How to enable all the Pager controls.

    What I am expecting is If I set the Total Records to the Grid it should automatically display me the Pager controls eventhough ItemsSource contains only one page record.

    As of I know this is the basic functionality why because if we have lacs of records then there is no meaning of getting all the lacs of record at one shot and display it in the Grid right. I hope this makes sense.

  • It has occured to me that it would look better with two changes.

    1) Use a XamNumericEditor box with the buttons for the page number and for the lines per page

    2) Bind the Page number box to the actual page number so that when you use the pager, it dynamically changes the box, so it is always current.  

    What changes would be required to your example to make these two changes?  Would the binding work?  If you used twoway binding would the page number change instantly without the code behind lostfocus event?

  • This is great, now I know where to not only put my page size box, but also my save, cancel buttons.  They fit nicely on the line with the pager.

    I have taken your modifications and adjusted them to work with RIA domaindatasource so that the location is preserved when you change the page size, i.e. you are still looking at the same data.

    Basically the trick is to calculate the new desired page to maintain the current position in the dataset, and then to add this line to the loaded_data event

    XamGrid.PagerSettings.CurrentPageIndex = newPage;

    if you do it in the lostfocus event, it gets undone when Ria reloads the data.

  • awesome video, I was searching the way to put there some buttons and stuff. But now I want to make it all generic, is it possible to make the whole thing like a user control ?

    Regards,

    Paúl