+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to enable paging for Search?

How to enable paging for Search?

10 posts, 0 answered
  1. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    15 Dec 2010
    Link to this post
    Hi Team,

    I am customizing sitefinity search result page and I need to implement paging. there is a control implemented, But it never displayed. It might be the size of the pager set to more than 10 since I get always lesser than 10.

    Please advice me.

    Thanks.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    15 Dec 2010
    Link to this post
    Hi Thavarajah,

    The SearchResult control has properties section  Paging where you can set  PostsPerPage.By default the PostsPerPage is set to 10 - if there are less then 10 items in the result the pager is not shown.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    15 Dec 2010
    Link to this post
    Thanks Ivan,

    But I do not find the property section, where can I find?

  4. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    15 Dec 2010
    Link to this post
    I found it..  thanks Ivan
  5. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    15 Dec 2010
    Link to this post
    Ivan,

    I want the paging as attached in the screen, how it is possible.

    For this I need total pages.
    Thanks.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Dec 2010
    Link to this post
    Hello Thavarajah,

    You need a custom pager. You can try using RadDataPager for ASP.NET AJAX, or just put a label on the left side that shows "Currently on page ....". You can do this inside Sitefinity/ControlTemplates/Search/SearchResults.ascx

    protected void Page_Load(object sender, EventArgs e)
        {
     
            PagerSize.Text = "Currently on :" + pager1.SelectedPage + "-" + pager1.PagesRange.ToString() + " of " + ResultsStats.Text;
            this.rptResults.ItemDataBound += new RepeaterItemEventHandler(rptResults_ItemDataBound);
             
        }
     
     
    ....
       .....
     
    <h2><asp:Literal ID="PagerSize" runat="server"></asp:Literal></h2>


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    16 Dec 2010
    Link to this post
    Thanks Ivan for your reply.
    pager1.PagesRange.ToString()
    is giving wrong value than the correct number of pages.

    I have attached the screen shot for my paging herewith. earlier one was wrong. this is correct one.
    sorry for inconvenience occurred.

    Thanks.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Dec 2010
    Link to this post
    Hello Thavarajah,

    The code should work fine. Please check this video searchpager.zip. The property pager1.PagesRange is set by the pager.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    16 Dec 2010
    Link to this post
    Actually total pages for my search is 2 but pager1.PagesRange shows it as 10 always. if you can please advice me how can I get the datasource of the 'rptResults' repeater control in the page load so that I can implement my own paging.
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    16 Dec 2010
    Link to this post
    Hi Thavarajah,

    1. You can subscribe for the ItemDataBound event of the repeater in the template and get the data items count.

    2. Creating a custom search results control.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
10 posts, 0 answered