[英]The @model directive in view does not bind the View model
The application is .Net Framework 3.5 and MVC Framework 1.0 The controller has: 该应用程序是.Net Framework 3.5和MVC Framework 1.0。该控制器具有:
namespace MockBDPWorkflowTestApp.Controllers
{
public class WorkFlowTestController : Controller
{
//
// GET: /WorkFlowTest/
public ActionResult OpenSubmission(string processId, string mailId)
{
var SubmissionModelView = new MockBDPWorkflowTestApp.ViewModels.WorkFlowTestViewModel{processInstance =processId, mail =mailId} ;
return View("Submission", SubmissionModelView);
}
}
}
The View Model has 视图模型具有
namespace MockBDPWorkflowTestApp.ViewModels
{
public class WorkFlowTestViewModel
{
public string processInstance { get; set; }
public string mail { get; set; }
}
}
The view has: 该视图具有:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
@model MockBDPWorkflowTestApp.ViewModels.WorkFlowTestViewModel
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The model directive is not recognized and @Model. 无法识别model指令和@Model。 does not give the option processInstance and mail
不提供选项processInstance和邮件
What am I missing , the bind to view is not happening. 我缺少的是,绑定视图没有发生。 Please can some one help.
请帮忙一下。
I think @model
is for the Razor views, but it looks like you might be using it in an .aspx page view. 我认为
@model
用于Razor视图,但看起来您可能正在.aspx页面视图中使用它。
You should instead try supplying the type like this: 您应该尝试提供如下类型:
Inherits="System.Web.Mvc.ViewPage<MockBDPWorkflowTestApp.ViewModels.WorkFlowTestViewModel>
see if that works. 看看是否可行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.