More in this section

Forums / Developing with Sitefinity / Wrapping Search Box problems

Wrapping Search Box problems

4 posts, 1 answered
  1. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    05 Feb 2010
    Link to this post
    Hello all,

    I'm wrapping the Search Box web control, and trying to call it from a user control. Initially I've left this pretty simple, as you'll see below, but it's disabling the overlay mode of the CMS when I drag it into the page, and in Classic mode, it disables the "Edit" link on any control on the page. When I place the control anyway (it has enough settings, so it should work) and publish, it doesn't work at all, but it doesn't generate an exception.

    Can you help?

    File1.cs
    using Telerik.Search.WebControls;
     
    namespace MyNameSpace {
        /// <summary>
        /// This is the wrapped Telerik Search Box
        /// </summary>
        public class BaseSearchBox : SearchBox {
        }
    }

    File2.cs
    namespace MyNameSpace {
     
        /// <summary>
        /// This is the wrapped Telerik Search Box, but particular to the blog
        /// </summary>
        public class BlogSearchBox : BaseSearchBox {   
        }
    }

    The code in front for the user control:
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="blogSearchBox.ascx.cs" Inherits="MyNameSpace.BlogSearchBoxControl" %>
    <%@ Register Namespace="MyNameSpace" TagPrefix="ca" %>
     
    <ca:BlogSearchBox ID="searchBox" runat="server"
        ResultUrl="~/blog/search-results.aspx"
        IndexCatalogue="Blog Search"
        LayoutTemplatePath="~/Sitefinity/ControlTemplates/Search/SearchBox.ascx"
        Enabled="true"
        EnableTheming="true"
        EnableViewState="true"
        Visible="true"
        WordsMode="AnyWord"
    />

    And the code behind for the user control:
    using System.Web.UI;
     
    namespace  MyNameSpace {
        public partial class BlogSearchBoxControl : UserControl {}
        }
    }

    Thanks!
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    08 Feb 2010
    Link to this post
    Hello Connections Academy Developer,

    Thank you for using our services.

    The Search Box is a script control. So when overriding it you should include a reference to the original Search.js file containing the scripts. Since this file is embedded in the Telerik.Search assembly the control is not able to get the reference to the script. Attached is the js file, you can include it in the markup of the user control:
    <telerik:JsFileLink ID="SearchBoxJs" runat="server" FileName="~/Sitefinity/Admin/Scripts/Search.js" />

    Note that there still might be problems with the Overlay edit mode.

    Best wishes,
    Radoslav Georgiev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
    Answered
  3. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    08 Feb 2010
    Link to this post
    Thanks, I'll give that a try and get back to you.
  4. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    08 Feb 2010
    Link to this post
    Thanks! That did it.
Register for webinar
4 posts, 1 answered