来自不同控制器的mvc3剃刀视图

use*_*430 1 asp.net-mvc razor asp.net-mvc-3

所以在我的个人资料控制器页面 我在create方法中有一个方法调用create

   if (Convert.ToInt32(calBMI) >= 25)
            {
                return View("Index", Survey);
            }
Run Code Online (Sandbox Code Playgroud)

我想将页面呈现为调查索引(调查是另一个控制器照顾调查),我如何做到让它工作,谢谢!

Shy*_*yju 5

 return View("~/Views/Survey/Index.cshtml", objSurvey);
Run Code Online (Sandbox Code Playgroud)

假设objSurvey您的模型/ ViewModel对象和Survey/index视图是强类型的objSurveyModel/ViewModel 类型

编辑:根据评论,如果您的视图没有强类型,您可以忽略第二个参数

public ActionResult GetSomeThing()
{
   return View("~/Views/Survey/Index.cshtml");
}
Run Code Online (Sandbox Code Playgroud)