More in this section

Forums / Developing with Sitefinity / Adding SearchBox to template in visual studio

Adding SearchBox to template in visual studio

3 posts, 0 answered
  1. Kevin
    Kevin avatar
    42 posts
    Registered:
    15 Mar 2005
    18 Jul 2009
    Link to this post
    I have set up my templates to use several sitefinity controls that I want to appear on every page, but I prefer to add these controls by hand in Visual Studio editing the .master page contents.  I have been trying to add a search box to each page, but can't seem to find what I need to use as a reference at the top of the page.  There is no entry for "Search Box" or "Search Results" defined in the web.config file.

    Would anyone be able to indicate to me how I can get a reference to SearchBox, similar to the following in my .master pages?

    <%

    @ Register src="~/Custom/UserControls/IconsSiteMenu.ascx" tagname="SiteMenu" tagprefix="sitefinity" %>

     

    <%

    @ Register src="~/Custom/UserControls/Login/LoginViewControl.ascx" tagname="LoginView" tagprefix="sitefinity" %>

     

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Jul 2009
    Link to this post
    Hi Kevin,

    You can use the following declaration to get the reference directly to the controls under Telerik.Search.WebControls namespace.

    <%@ Register TagPrefix="sr1" Assembly="Telerik.Search" Namespace="Telerik.Search.WebControls" %> 

    or

    <%@ Register TagPrefix="search" TagName="searchBoxControl" Src="~/Sitefinity/ControlTemplates/Search/SearchBox.ascx" %> 
     


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Kevin
    Kevin avatar
    42 posts
    Registered:
    15 Mar 2005
    18 Jul 2009
    Link to this post
    Ivan:

    Thanks, it works as expected with the following code (I'm using a custom 'layout' file):

    <%@ Register TagPrefix="sr1" Assembly="Telerik.Search" Namespace="Telerik.Search.WebControls" %>   
     
    <sr1:SearchBox ID="search" runat="server" LayoutTemplatePath="~/Custom/ControlTemplates/Search/SearchBox.ascx" ResultUrl="~/Search.aspx" IndexCatalogue="EntireSite"></sr1:SearchBox> 
     

    PS: Do you guys actually have days off?  I'm always surprised at how frequently I get replies on Saturday and Sunday! :-)
Register for webinar
3 posts, 0 answered