Gravatar for

Question by Cris Corra, Aug 4, 2014 3:11 PM

How do I access the Rendering Parameters in an mvc view that uses the SearchModel model?

I want to do what is described here, in an mvc view. I cannot find a way to do so w/o creating a new model template that inherits the SearchModel and using that.

-Cris Corra

Gravatar for

Comment by Simon, Feb 16, 2015 5:43 PM

The issue found by the client is a duplicate value between the Content editor and the Page Editor. This issue has been fixed in October 2014 release of Coveo for Sitecore

1 Reply
Gravatar for

Answer by Luc Bergeron, Aug 4, 2014 3:54 PM

When using MVC, you can access the list of parameters like this:

@Model.BoundRendering.Parameters["Additional Parameters"]

Unfortunately, I just noticed that the additional parameters are not parsed as they should. Using the code sample above returns all additional parameters as a single string. I will open an issue to fix it.

To work around this issue, you can use this Sitecore method that will help you parse the additional parameters:

NameValueCollection Sitecore.Web.WebUtil.ParseUrlParameters(string)

Here is a code sample that should do what you want:

@(Sitecore.Web.WebUtil.ParseUrlParameters(Model.BoundRendering.Parameters["Additional Parameters"])["MyCustomParameter"])

Hope this helps


Gravatar for

Comment by Cris Corra, Aug 4, 2014 5:17 PM

I get the following error when I use the 2nd code snippet:

Server Error in '/' Application.

Compiler Error Message: CS0122: 'Coveo.UI.Mvc.Models.BaseModel.BoundRendering' is inaccessible due to its protection level

Gravatar for

Comment by Luc Bergeron, Aug 5, 2014 9:43 AM

Which version of Coveo for Sitecore are you using? The scope of the BaseModel.BoundRendering property is public since the June 2014 release (3.0.532).

Gravatar for

Comment by Cris Corra, Aug 19, 2014 11:14 AM

July 2014 release (3.0.558)

Ask a question