views:

49

answers:

1

I'm creating a custom ActionResult class and I need it to be able to operate on a UserControl. All of the examples I've found so far pass in the full path like so:

return MyResult("~/Areas/AreaName/Views/ControllerName/UserControlName.ascx", myModel);

That's pretty long so I'd like it to operate the same way as calling View(), i.e. I just pass in the name and MVC determines the correct route:

return MyResult("UserControlName", myModel);

Is there a way I can find out the correct route to the control without specifying it manually?

A: 

Why not inherit from ViewResult and override the methods you need?

Daniel A. White
That worked, using FindView to find the control.
Dave