This project is read-only.

@Html.Action on Admin controller

Topics: Writing modules
Aug 8, 2011 at 9:09 AM


I hit an odd issue over the weekend that I can't figure out. I've got a controller returning a partial view that I need to display in the view for another controller, which is marked as [Admin] as it provides an admin interface. In the view, I use the Html.Action method to render it like so:

@Html.Action("ActionName", "ControllerName", new { area = "Some.Module", id = 1234 })

The admin controller it is shown by displays an editor form (not an Orchard part or item editor, just a simple ASP MVC one). This works fine when requesting with a HTTP GET, however I get an exception when submitting the form (via POST) like this:

"Action 'ActionName' on controller 'ControllerName' cannot be found".

Does "ActionName" need to handle both GET and POST requests (I did try this but it didn't appear to work)?

Aug 8, 2011 at 10:34 PM

You may need to decorate your action with an AcceptVerbs attribute.