Change PageSize of a RadDataPager

2 posts, 0 answers
  1. Kurt
    Kurt avatar
    17 posts
    Member since:
    Aug 2006

    Posted 24 Apr 2010 Link to this post

    I have a User Control with a ListView that is using the RadDataPager. I wanted to do something fairly simple and that was to have a PageSize property on my user control that could be used to set the RadDataPager.PageSize property.

    Now, I did get this to working using the following code:

    <telerik:RadDataPager ID="DataPager" runat="server" PagedControlID="myListView" 

    The only issue I have with this is this that if the page size is different from whatever the default value is, the parent listview DataBound event is fired two times, once for the original page size, and a second time if a new value is specified.

    Although this is not a big issue, it would be cool if there were a way to set the RadDataPager.PageSize property before its gets databaound; however, I was not able to find the "DataPager" using the listviews.FindControl method any earlier in the page life cycle.
    I did try Page_Load, ListView.NeedDataSouce, ListView.DataBinding, ListView.Init.

  2. BaiH
    BaiH avatar
    83 posts
    Member since:
    Aug 2008

    Posted 27 Apr 2010 Link to this post

    In order to access the DataPager, placed inside the ListView you can use LayoutCreated event. However as the pager is inside the ListView controls collection, changing the page size will always require at least two creation of the control's items. You may think about moving the pager outside of the ListView layout template and thus setting the PageSize property directly to it.

  3. DevCraft R3 2016 release webinar banner
Back to Top