Tutorial: Customize the label of the search button in a multiple site project
This article describes how to customize the label of the search buttons on the different sites in your multiple site project. There are two approaches for customizing the label – you can hard-code the label for each site and you can dynamically change the label via the Labels & Messages page.
The two approaches below assume that you have three sites, named FirstSite, SecondSite, and ThirdSite. You want the search button label to be different on all sites:
- FirstSite – the standard label Search
- SecondSite – custom labeled Search2
- ThirsdSite – custom label Seach3
To display different text in different search buttons, you must create a custom search widget.
Perform the following:
- Open your project in Visual studio and create a new Web User Control (.ascx file).
To do this, perform the following:
- In the context menu of SitefinityWebApp, click Add » New Item…
- Under Visual C#, click Web » Web User Control.
- In Name, enter CustomSearchBox.ascx
You will use the file as template for the custom search widget.
- Inside the CustomSearchBox.ascx, place the markup of the custom search widget:
-
Register the custom widget template for search box widget by mapping the newly created widget to the standard Search widget.
Perform the following:
- In the backend, click Administration » Settings » Advanced » Controls » ViewMap » Create new.
- In Host, enter Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox
- In LayoutTemplate, enter ~/CustomSearchBox.ascx
-
Save your changes.
- Use one of the following approaches to display the custom button label: