I'm trying to implement a non-Umbraco-based controller in an Umbraco project. The reason for it to not inherit from an Umbraco controller is that it's not dependent on any content within Umbraco.
I have this controller:
public class SearchController : System.Web.Mvc.Controller
{
public ActionResult Index(string query)
{
SearchViewModel viewModel = Search(query);
return View(viewModel);
}
}
I also have a rule set up so that I actually hit my action method when navigating to /Search?query=foo+bar.
My view (~/Views/Search/Index.cshtml) defines that SearchViewModel should be model, but still I get the following exception:
Cannot bind source type MyNamespace.SearchViewModel to model type Umbraco.Web.Models.RenderModel.
Does my model really need to inherit from RenderModel for this to work?
Non-Umbraco-based controller: Cannot bind source type...
Hi!
I'm trying to implement a non-Umbraco-based controller in an Umbraco project. The reason for it to not inherit from an Umbraco controller is that it's not dependent on any content within Umbraco.
I have this controller:
I also have a rule set up so that I actually hit my action method when navigating to
/Search?query=foo+bar
.My view (
~/Views/Search/Index.cshtml
) defines thatSearchViewModel
should be model, but still I get the following exception:Does my model really need to inherit from
RenderModel
for this to work?Thanks. /Viktor
What is the problem with inheriting from Umbraco.Web.Mvc.SurfaceController? I would use this just to handle the routing:
is working on a reply...