Different views for same actions in ASP.NET MVC 2 -- should I inherit controller? -


Good day!

I have an application where I can include iframe with two different HTML-site-wide master pages for the normal page and a different design design (HTML code) and other master pages. One is for the.

Now I have a controller with some actions. Idea for the normal page, the time to create IFRAME version is the form field, validation and processing is the same, so I want to make it dry as possible.

Is it possible to inherit this controller to be able to create a new view? Namespace My Controllers {Public Class SomeController: Base Controller {[HTTPGATE} Public Action Result Process MyForm () {...} [HTTP Post] Public Action Result Process Mimeform (Form Collection Form) ) {...}}}

View / view / MyController

and

  namespace MyControllers {The public class will be in someControllerWithDifferentViews: some controllers {// here nothing}}   

In various views, / view / What will happen in some controller widespread visual [/ code>

?

You can only try to cross a query to your ActionResult handler, which address To do that service is to serve.

  [HTTP Post] Public Functioning Processform (Form Collection Form, B Ool isIFrame) {... Kick ... ... (ififrame) {Return View ('MyFormIFrame')} and {See Return ('MyForm'); }}   

And if you want to map different routes for this handler, then you can do the following

  routes.MapRoute (" MyForm "," / mycontroller / verb ", new {controller =" microcontroller ", action =" process myoform ", IIFRM = FAP,}); Routes MapRoute ("MyFormIFrame", "/ mycontroller / action-iframe", new {controller = "mycontroller", action = "process myoform", isIFrame = true,});    

Comments