RadDatapager with Asp Datalist

2 posts, 0 answers
  1. Kutbuddin
    Kutbuddin avatar
    2 posts
    Member since:
    Mar 2011

    Posted 19 Nov 2011 Link to this post

    <div class="product-grid">
    <asp:DataList ID="dlProducts" runat="server" RepeatColumns="2" RepeatDirection="Horizontal"
    RepeatLayout="Table" ItemStyle-CssClass="item-box">
    <nopCommerce:ProductBox1 ID="ctrlProductBox" Product='<%#Container.DataItem%>'
    runat="server" />
    <div class="clear">
    <div class="product-pager">
    <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="dlProducts">
                    <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                    <telerik:RadDataPagerButtonField FieldType="Numeric" />
                    <telerik:RadDataPagerButtonField FieldType="NextLast" />
                    <telerik:RadDataPagerGoToPageField />
                    <telerik:RadDataPagerNumericPageSizeField />
                    <telerik:RadDataPagerSliderField />

    please help me how can i use raddatapager with asp datalist ???

    i tried this but its not working
  2. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 22 Nov 2011 Link to this post

    Hello Kutbuddin,

    The ASP:DataList controls implements neither the IPageableItemContainer nor the IRadPageableItemContainer interfaces. That is why you cannot use RadDataPager to page it directly by simply setting the RadDataPager PagedControlID.
    However you can implement paging in a similar manner as it is done in this demo. The main points here are:
    - you need to handle the OnTotalRowCountRequest event of the RadDataPager and there set the TotalRowCount;
    - you need to handle the PageIndexchanged event of the RadDataPager. The you need to assign the new DataSource for the DataList and call its DataBind method so it is populated with the data for the new page.

    Additionally, to use the RadDataPager control with no code, you can implement your data visualization though ASP:ListView or RadListView. See the below demos for more information:

    Iana Tsolova
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top