In Umbraco 10 I have a simple form on a nav bar which calls a controller method and passes in a coupe of parameters to do a search. The search works fine, I then want to open a page to show the results.
form (this seems fine, it calls the controller as expected):
Should the SearchResults page inherit from it's stronly-typed published model - searchResults - rather than the model used for the searchData? If so, how would I pass the results of the search to it?
If I put breakpoints in the SearchResults page I can see the correct results in the line var m = Model, it then fails as it cant bind model SearchData to IPublishedContent
Pass model data to an Umbraco 10 page
Can someone point out what I'm doing wrong here?
In Umbraco 10 I have a simple form on a nav bar which calls a controller method and passes in a coupe of parameters to do a search. The search works fine, I then want to open a page to show the results.
form (this seems fine, it calls the controller as expected):
Controller method (again, fine - correct search results are returned):
And the basics of the SearchResults page:
Should the SearchResults page inherit from it's stronly-typed published model - searchResults - rather than the model used for the searchData? If so, how would I pass the results of the search to it?
If I put breakpoints in the SearchResults page I can see the correct results in the line var m = Model, it then fails as it cant bind model SearchData to IPublishedContent
You are passing searchResults to the SearchResults view. What is the type of searchResults? Is it SearchData?
If not you should replace SearchData with the type of searchResults in
UmbracoViewPage<>
is working on a reply...