More in this section
Forums / Sitefinity SDK / How to get a custom search going...

How to get a custom search going...

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    03 Dec 2008
    23 Jan 2011
    Link to this post
    I want the existing search control (has the designer, etc)...

    But I want it to have a RadTextBox instead of just a plain input

    How do I go about that with the templates?
  2. Ivan Pelovski
    Ivan Pelovski avatar
    43 posts
    24 Sep 2012
    25 Jan 2011
    Link to this post
    Hello Steve,

    Unfortunately you cannot change the template from Design -> Widget Templates page because there is custom logic depending on the controls used in it. You will have to inherit the SearchBox class itself and add new logic to it. What you will need is:
    • Override the LayoutTemplateName property to return null
    • Override the LayoutTemplatePath property to return the location of your template
    • Make the old TextBox control in the template not visible
    • Override the InitializeControls() method and initialize your RadTextBox control
    • Override the Query property although it is not virtual
    • Override the GetScriptDescriptors() method in order to include the component id of the RadTextBox control
    • Override the GetScriptReferences() method in order to reference a new script file
    • Inherit the class declared in "Telerik.Sitefinity.Services.Search.Web.UI.Scripts.SearchBox.js" file in order to make use of the RadTextBox cliet API.
    • Mark your new class with the needed attributes PropertyEditorTitleAttribute and ControlDesignerAttribute
    • Add your widget to the Toolboxes configuration.
    A code sample is also attached. Put the ascx file in /App_Data/CustomControlTemplates/ folder and the js file in the base directory of the site. If you place the files somewhere else then make the corresponding changes to the paths in the code (the layoutTemplatePath and searchBoxScript constants). You can also see this thread in the forum

    Ivan Pelovski
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered