Search code examples
asp.net-mvc-3actioncontrollerasp.net-mvc-partialview

Asp.net mvc 3 - actioncontroller returning partialview another actioncontroller


I would like to have an action controller which return a partialview of another actioncontroller.

public ActionResult Method1 (string s)
{
return PartialView (_PartialViewMethod1, object1);
}

public ActionResult Method2 ()
{
return PartialViewOfMethod1;
}

I tried this on method2: return PartialView (Method1(s)) but it does not work, how can I achieve this ?

Thanks


Solution

  • Try this:

    public ActionResult Method2()
    {
        string s = "someDefinedString";
    
        // instead of return PartialView(Method1(s));
        return Method1(s);
    }