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

Forums / Developing with Sitefinity / Search Box in Custom User Control

Search Box in Custom User Control

6 posts, 0 answered
  1. D
    D avatar
    9 posts
    Registered:
    05 Jun 2009
    11 Jun 2009
    Link to this post
    In advance, thanks for all the help, the forums have been incredibly useful over the span of learning how to use Sitefinity.

    I'm currently using two custom user controls, header.ascx and footer.ascx, which are dragged into ContentPlaceHolders on a master page.

    I have successfully indexed the site and would like to add a Search feature to the header.ascx file, so that there is a search box on each page. I already have the destination page (searchresults.aspx) set up, but the search box itself can't simply be dragged into a ContentPlaceHolder if the idea is to have it as part of a user control.

    So, the simple question is, what is the <% Register / <control : tag / etc. method for adding a search box to my custom header, and how would I go about setting the critical variables (index to be used, destination page, etc.)

    Or, is there a simpler option I'm overlooking?

    Thanks once more for all your help.
    -D
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    12 Jun 2009
    Link to this post
    Hello D,

    Thank you for using our services.

    Below is the declaration that you can use in your control template.

    <%@ Register TagPrefix="sfSearch" Namespace="Telerik.Search.WebControls" Assembly="Telerik.Search" %> 
     
    <sfSearch:SearchBox ID="searchBox1" IndexCatalogue="your_index_here" ResultUrl="results_Url_here.aspx" runat="server"></sfSearch:SearchBox> 

    Using the code above you should be able to access all properties of the control.

    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. D
    D avatar
    9 posts
    Registered:
    05 Jun 2009
    12 Jun 2009
    Link to this post
    It works perfectly - I was able to easily add the control, point it to the proper index, to the proper results page, and stylize it with CSS. Thanks! :)

    Next stop, a similar issue with login boxes, but I think I can use the same method as above to figure that one out. Thanks again!
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    12 Jun 2009
    Link to this post
    Hello D,

    For the login controls we use the standard asp.net controls and you should not register the control. If you get stuck somewhere, let us know.

    Greetings,
    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.
  5. Julio Molina-Muscara
    Julio Molina-Muscara avatar
    4 posts
    Registered:
    12 Aug 2005
    28 Aug 2009
    Link to this post
    I also found this post useful, thanks Telerik. But I wanted to inform you that there is a little issue in the source code sample; a missing "=" in the Register clause between Assembly and Telerik.Search.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    28 Aug 2009
    Link to this post
    Hi Julio Molina-Muscara,

    Thank you for your input. The missing "=" has been added.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered