简体   繁体   English

强类型的局部视图

[英]Strongly typed partial view

I am working on an asp.net application and I have created a folder named Models inside it. 我正在开发一个asp.net应用程序,我在其中创建了一个名为Models的文件夹。 I have a class named instructor in it. 我有一个名为讲师的课程。 I am creating a partial view and making it strongly typed with this statement 我正在创建一个局部视图并使用此语句强类型化

@model RazorView.Models.Instructor

But I am getting this error : 但是我收到了这个错误:

The type name 'Models' does not exist in the type 'System.Web.Mvc.RazorView' “System.Web.Mvc.RazorView”类型中不存在类型名称“Models”

public class _Page_Views_Home_Index_cshtml : System.Web.Mvc.WebViewPage> { public class _Page_Views_Home_Index_cshtml:System.Web.Mvc.WebViewPage> {

How can I fix it? 我该如何解决?

您需要更改名称空间,System.Web.Mvc使用RazorView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM