Finding ASP.NET MVC User Control
- by Dave
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("~/ControllerName/UserControlName.ascx", myModel);
But 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?