Gravatar for daniel.reedy@tcw.com

Question by Daniel Reedy, Apr 5, 2016 6:14 PM

configure search box control programmatically

I am able to render a Coveo Search Box in a sample page; however, I can't get it to work when I statically define the Coveo control in my own control like this:

<sc:Sublayout id="CoveoSearchBoxResources" runat="server" Path="/layouts/tcw.com/controls/Global/CoveoSearchBoxResources.ascx" />
<sc:Sublayout id="TCWSearchBox" runat="server" Path="/layouts/tcw.com/controls/Global/TCWSearchBox.ascx" />

I think it's because step #5 in these instructions is pending: https://developers.coveo.com/display/public/SC201507/Integrating+a+Coveo+Search+Box+in+your+Page+Layout

…so, my question is: how do I set [Unique identifier] and [Search page item id] at runtime in C#, or even in the markup?

1 Reply
Gravatar for daniel.reedy@tcw.com

Answer by Daniel Reedy, Apr 7, 2016 1:24 PM

This has been resolved by Sitecore Support community: https://community.sitecore.net/developers/f/8/p/2951/8789#8789

The gyst is that I can pass them in the Parameters markup attribute:

<sc:Sublayout id="TCWSearchBox" runat="server" Path="/layouts/tcw.com/controls/Global/TCWSearchBox.ascx"
 Parameters="SearchBoxUniqueId=TCWSearchBoxId&SearchPageItemId={26446EE4-2985-4444-8012-BFD625095614}" />
Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Apr 7, 2016 2:13 PM

Very good to know. I wasn't aware of that method. Thanks for sharing Daniel!

Ask a question