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

Forums / Developing with Sitefinity / Include SearchBox in MasterPage

Include SearchBox in MasterPage

6 posts, 0 answered
  1. Markus
    Markus avatar
    3 posts
    Registered:
    06 Nov 2007
    09 Apr 2008
    Link to this post
    Hi Everybody,

    we are preparing our new company site structure and templates. We have managed to integrate some common controls and functionality in the masterpages. Works great for Menu, Breadcrumbs, Submenus (based on Menu) and others.

    At the moment, I am trying to implement a searchbox in a masterpage to make it available through all the pages that use the modified template. I am able to reference the searchbox.ascx and use that one. Issue: this is the template and it does not provide the functionality I am looking for. Didn't find the right approach in the docs or in the forums. Can you give me a hint on how you would propose to get this done ?

    Thanks in advance,
    Kind regards,
    Markus
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    10 Apr 2008
    Link to this post
    Hello Markus,

    Firstly, you need to register SearchBox custom control on the .master page. To reference the control use the @ Register directive:

    <%@ Master Language="C#" %> 
    <%@ Register tagprefix="cc" namespace="Telerik.Search.WebControls" assembly="Telerik.Search" %> 

    After registering SearchBox, you should declare it and set the necessary properties like IndexCatalogue and ResultUrl:

    ... 
    <div id="TopNavigation"
         <cc:SearchBox id="SearchBox1" runat="server" IndexCatalogue="AllPages" ResultUrl="~/SearchResults.aspx"></cc:SearchBox> 
    ... 

    Hope this helps.

    All the best,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Markus
    Markus avatar
    3 posts
    Registered:
    06 Nov 2007
    11 Apr 2008
    Link to this post
    Hi Pepi,

    that actually does the trick ;)
    Thank you very much for your help !

    BTW: I didn't find that resource in the documentation. Is it included somewhere ?

    Kind regards,
    Markus
  4. Brett
    Brett avatar
    5 posts
    Registered:
    27 Mar 2008
    13 Apr 2008
    Link to this post
    I've done this but in visual studio (2008 Web Developer) I see an error in design mode. Error Rendering Control - An unhadled exception has occured. Object reference not set to an instance of an object.

    I uploaded the master page to see if I could learn anything else and when I veiw the template I get a script error "Error: 'length' is null or not an object.

    When I debug the error it takes me to the following line of Sitefinity code:

    for (var i = 0boxLen = boxes.length; i < boxLen; i++)  
     

    Any ideas are appreciated.
    Thanks.
  5. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    14 Apr 2008
    Link to this post
    Hi Brett,

    Unfortunately, we can not reproduce the problem. Please, give us more detailed information to localize what is the reason for the described behavior. The javascript code is relative to the Overlay mode in edit page. So, send us your .master page with the SearchBox on it and all related CSS and javascript files to debug the issue locally. Also, what is the exact version of your Browser and do you have any custom implementations for the SearchBox control?

    Thanks for your cooperation in advance.

    Regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Brett
    Brett avatar
    5 posts
    Registered:
    27 Mar 2008
    15 Apr 2008
    Link to this post
    Thanks for offereing a second set of eyes.

    I'll submit a ticket with the files.
Register for webinar
6 posts, 0 answered