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

Forums / Developing with Sitefinity / how to show total records in search result page?

how to show total records in search result page?

7 posts, 0 answered
  1. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    02 Jun 2010
    Link to this post
    Hi sir,

    I am using sitefinity3.7 site search. In that i want to display total records. how to display it?


    My design is like this

    Search results for: "search data" ( "total records"  results found)

    Displaying results 1-10 of "total records"
    1. search data 1
    2. serach data 2
    3.search data 3

    << 1 2 3 4 5 >>

    How can i achieve this..?

    I had done everything but i cannot get total search item records...pls help.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Jun 2010
    Link to this post
    Hi sathiyaseelan,

    Thank you for using our services.

    The Search Results control has a literal which holds results statistics:
    <h2><asp:Literal ID="ResultsStats" runat="server">Found {0} pages for "{1}" </asp:Literal></h2>

    This literal contains the count of all search results. You can modify the text to say total results instead of pages:
    <h2><asp:Literal ID="ResultsStats" runat="server">Search results for: {1} ({0} total results found)</asp:Literal></h2>


    Sincerely yours,
    Radoslav Georgiev
    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. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    03 Jun 2010
    Link to this post
    Hi sir,

    I understood. I had used the literal control for dispalying
    Search results for: "search data" ( "total records"  results found)

    how will i dispaly this
    Displaying results 1-10 of "total records"

    I need a total records...can it be done?

    Thanks,
    sathiya
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Jun 2010
    Link to this post
    Hi sathiyaseelan,

    The Text property of the Literal  control - ResultsStats shows the totalItems returned by Search method of SearchManager.

    1. Add new label control inside Sitefinity\ControlTemplates\Search\SearchResult.ascx

    <h2><asp:Literal ID="ResultsStats" runat="server" Visible="false">Found {0} pages for "{1}" </asp:Literal></h2>
    <h2><asp:Literal ID="PagerSize" runat="server"></asp:Literal></h2>


    2. In PageLoad add the following code

    protected void Page_Load(object sender, EventArgs e)
        {
     
            PagerSize.Text = "Displaying results:" + pager1.SelectedPage + "-" + pager1.PagesRange.ToString() + " of " + ResultsStats.Text;
             
        }

    You could set Visible false to ResultsStats in case you want to hide the default label.

    Sample video has been attached.

    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.
  5. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    03 Jun 2010
    Link to this post
    Hi,

    Thanks for your reply...

    As per my design i have already used "Resultstats" literal control for displaying this..
    Search results for: "search data" ( "total records"  results found)

    so i cannot hide it and also i need only total records for the design
    Displaying results 1-10 of "total records"

    so right now i used like this to find total records:

    IList

     

    <ResultItem> results = SearchManager.Search(strsearchQuery, IndexCatalogue);//params i vl get from querystring

     

    iTotalrecords = results.Count;

     

    Thanks,
    sathiya

     

  6. Khizar
    Khizar avatar
    3 posts
    Registered:
    17 Jun 2011
    17 Jun 2011
    Link to this post
    Hai Iam facing a problem in my website, when search some word in arabic(like الشركاء) then ResultStats message is "الشركاء Results found for 3" which is very acquard for viewers, as they are searching in arabic. How can i translate "Results found for 3" in Arabic at during search. Also I need proper direction (rtl).
    I have tried to replace message of ResultStats literal with arabic but it displays unicode not arabic.

    Thanks
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Jun 2011
    Link to this post
    Hi Khizar,

    You can detect the CurrentUICulture and load a custom stylesheet that will switch the position of the elements to rtl. Another option is using two themes - one that will show all data in rtl and another that will display everything in ltr format.

    To change the language of the Found ... pages for..
    You need to use resx file Text="<%$Resources:Found %>">  instead of harcoding the text in the SearchResults template

    <h2><asp:Literal ID="ResultsStats" runat="server" Visible="false">Found {0} pages for "{1}" </asp:Literal></h2>


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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
7 posts, 0 answered