Search Box Template
Hi Team,
I just upgraded my sitefinity 4 project to RC 2 this week and i was able to add the search box to the master page using the following code:
<%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" Assembly="Telerik.Sitefinity" %>
<
sitefinity:SearchBox
ID
=
"searchBox"
runat
=
"server"
IndexCatalogue
=
"MyIndex"
ResultsUrl
=
"~/Search"
></
sitefinity:SearchBox
>
Hi George ,
You can map the template by using LayoutTemplatePath property. Below is the declaration of the template
<%@ Control Language="C#" %>
<%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
<
fieldset
id
=
"main"
class
=
"sfsearchBox"
runat
=
"server"
>
<
asp:TextBox
ID
=
"searchTextBox"
runat
=
"server"
CssClass
=
"sfsearchTxt"
/>
<
asp:Button
id
=
"searchButton"
runat
=
"server"
Text="<%$Resources:SearchResources, Search %>" OnClientClick="return false;" CssClass="sfsearchSubmit" />
</
fieldset
>
Hi Ivan,
Thank you for your response, I have mapped the external template as you suggested and changed the layout. However, the other issue is that the control is not working
I have set the properties as follows
<
sitefinity:SearchBox
ID
=
"searchBox"
runat
=
"server"
IndexCatalogue
=
"MyIndex"
ResultsUrl
=
"~/Search"
LayoutTemplatePath
=
"~/Custom/ControlTemplates/SearchBox.ascx"
></
sitefinity:SearchBox
>
Hi Ivan,
Do you have any input on the above.
Appreciate it.
G
Hello George ,
Can you send us a quick mock-up of the the search widget that you want to create? I think it would be easier for us to help you and to propose the best solution.
Best wishes,
Jordan
the Telerik team
Hi Jordan,
I have attached an image of the layout that i am trying to achieve for the search box. I managed to add the search box to the master page as a control (i have added the code in this thread).
The only problem is that once i embed the search box in the master page and not through sitefinity the button do not trigger a postback.
<%@ Control Language="C#" %>
<%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
<
div
class
=
"searchbox"
>
<
asp:TextBox
ID
=
"searchTextBox"
runat
=
"server"
CssClass
=
"searchText"
ClientIDMode
=
"Predictable"
/>
<
asp:Button
ID
=
"searchButton"
runat
=
"server"
Text
=
"Search"
CssClass
=
"searchSubmit"
OnClientClick
=
"return false;"
/>
</
div
>
<
script
type
=
"text/javascript"
>
$(function ()
var searchBox = $("[id$='_searchTextBox']");
addWaterMark(searchBox, 'search');
);
</
script
>
After investigating the generated code, I found that the index catalog in the javascript code is not being set ... How will i be able to set the index catalog? and what is SearchIndexPipeId property?
Sys.Application.add_load(loadHandler);
)();Sys.Application.add_init(function()
$create(Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox, "indexCatalogue":"","resultsUrl":"/Search","searchButton":$get("searchBox_ctl00_ctl00_searchButton"),"searchTextBox":$get("searchBox_ctl00_ctl00_searchTextBox"),"wordsMode":0, null, null, $get("searchBox"));
Hello George ,
You can use the built-in SearchBox control. You have to set SearchIndexPipeId property. It gets or sets the ID of the search index pipe from which the search catalogue is resolved. The easiest way to get the pipe Id is to make a query to [sf_publishing_pipe_settings] table of the database.
Regards,
Ivan Dimitrov
the Telerik team
Hi Ivan,
I tried your solution and it finally worked.
Appreciate it
Best,
G
Hi George ,
Can u Please share ur Search Code Step by Step ... i have Created my Site in Sitefinity 4.0 ... i want to implement Site Search ...
Please wil be highly Appreciated ...
Thanks & Regards
Anu.
Hi Ivan,
Can u Please share ur Search Code Step by Step ... i have Created my Site in Sitefinity 4.0 ... i want to implement Site Search ...
Thanks & Regards,
Pravat Sharma
hey guys,
Sorry for the late reply. Check out this blog post, i explained it there
http://gsaadeh.com/blog/11-05-31/Adding_Searchbox_directly_to_your_Template_in_SF_4.aspx
Cheers