More in this section

Forums / Developing with Sitefinity / Use a custom template instead of the OOTB SearchResult.ascx

Use a custom template instead of the OOTB SearchResult.ascx

6 posts, 2 answered
  1. Tom
    Tom avatar
    19 posts
    Registered:
    15 Sep 2009
    25 Feb 2010
    Link to this post
    Hi there!

    I try to use a custom template instead of the OOTB SearchResult.ascx. Isn't it possible to use the Telerik.Sitefinity.Configuration.ControlsConfig.xml to do so?

    Regards,
    Tom

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Feb 2010
    Link to this post
    Hello Tom,

    The template of SearchResults control is not embedded it is located in the solution. You will find it under Sitefinity/ControlTemplates/Search folder.

    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.
    Answered
  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    25 Feb 2010
    Link to this post
    another suggestion is to define your template in whatever folder you use (I place mine in /templates/public) so they're all in one place, and use the LayoutTemplatePath property to define the template for the control:

    <cc:SearchBox ID="SearchBox1" runat="server" IndexCatalogue="All" ResultUrl="~/Search.aspx" LayoutTemplatePath="~/Templates/Public/Search/SearchBox.ascx" />

    you can copy the control from the /sitefinity/controltemplates/search folder and place it in your own section.

    hope this was helpful!
  4. Tom
    Tom avatar
    19 posts
    Registered:
    15 Sep 2009
    26 Feb 2010
    Link to this post
    Thanks for the responses! I already knew about the possibility to define a custom template for the SearchBox controls. In fact I have done this for my site. But it would be desirable to specifiy the SearchResultTemplate path on the SearchResult control, inside web.config or Telerik.Sitefinity.Configuration.ControlsConfig.xml.

    Something I don't get is how I can tell that a template is embedded and therefore configurable through Telerik.Sitefinity.Configuration.ControlsConfig.xml. I had similar questions posted here:
    http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/how-do-i-map-an-external-template-to-the-templatepropertiestemplate.aspx
    Is there an easy rule of thumb, when what and where templates are configurable?

    I also suggest to make all the templates from the Sitefinity directory (e.g. UserControls, ControlTemplates, Admin/ControlTemplates). This is highly desirable from the aspect to extend the default templates to match the customers needs. Editing anything in the Sitefinity-Folder is no option due to maintenace issues.

    Any input here?

    Regards,
    Tom
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    26 Feb 2010
    Link to this post
    Hi Tom,

    Thank you for sharing your thoughts.

    All controls which use external templates are listed in the control configuration file part of the external templates archive file which you can download from your client account. Controls such as the search controls, and forum controls which do not use embedded templates can be configured from their control editor to use a different path for the control template, see attached image. So you can simply copy their templates to another location, edit them and then point the controls to them.

    Files located in ~/Sitefinity/UserControls/ such as navigation and login controls are simple user .ascx controls with code behind file. WebUserControls do not support embedded templates. If you wish to modify them, but keep the original in the Sitefinity directory you can do is to copy/paste them to another location and then change their url property in your web.config file:
    <toolboxControls>
     <clear />
     ...
     <add name="Site Tabstrip" section="Navigation" url="~/YourPathHere/" />

    Greetings,
    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.
    Answered
  6. Tom
    Tom avatar
    19 posts
    Registered:
    15 Sep 2009
    28 Feb 2010
    Link to this post
    Thank you Ivan! This should clear up things quite a bit!
    I plan to take a closer look on the topic for tomorrow.

    Regards,
    Thomas
Register for webinar
6 posts, 2 answered