sitefinitysitefinity-feather

Filter expression for dynamic content in sitefinity


Using SF 9.1 feather. Have created two modules in the module builder. One is a related data field of other. Specifically products is the parent and promotions is the child. When I drop the product widget onto a page I like to specify a filter vs displaying all products. I can limit the products via the filter expression in advance mode of the model. I seem to be able to find examples of filters for simple properties say price. But how do I filter based on a property of its related data? Eg promotion expiration date.

Alternatively is there a way to pass a string as a parameter to the widget so I can filter the products in razor ?


Solution

  • In this case I think it is better to create your own MVC controller. Inside of it you get the data using the Sitefinity API, sort by whatever you want and pass it to the view (which should be custom as well).

    There is no easy way to pass a random string from the built-in widget to the built-in View. I've once used the CssClass property to pass a string, but as you can imagine it is not too safe and is prone to errors.