In Composite C1, how can I pass a parameter to a C1 function that is rendered within a Webforms user control?
In my case, I want to include the SimpleSearch results in my user control:
<rendering:Function runat="server" id="fnSimpleSearch" >
<f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="Composite.Search.SimplePageSearch.SearchResults">
<f:param name="SearchQuery" value="<%= SearchTerm %>" />
<f:param name="CurrentSite" value="False" />
<f:param name="PageSize" value="10" />
<f:param name="ShowSearchForm" value="True" />
</f:function>
</rendering:Function>
This is the CodeBehind:
public string SearchTerm { get; set; }
protected override void OnLoad(EventArgs e)
{
C1PageRoute.RegisterPathInfoUsage();
string pathInfo = C1PageRoute.GetPathInfo();
if(!string.IsNullOrWhiteSpace(pathInfo))
{
SearchTerm = pathInfo.Substring(1);
}
base.OnLoad(e);
}
If I do it this way, the function will not be rendered in the final page, instead just the markup is rendered. If I put a static value in for the SearchQuery parameter, it is rendered though.
How do I pass the SearchQuery parameter from my CodeBehind so that the function will be rendered correctly?