Asp.net mvc 如何在MVC.NET视图中从库继承
我试图在我的MVC.Net网站中实现CKFinder,但是默认设置仅适用于常规asp.Net网站,因此我尝试将其更改为正常 一页从库CKFinder.Connector.Connector继承。在过去,我的aspx只能继承CKFinder.Connector.Connector,但是在MVC.NET中是如何做到的呢Asp.net mvc 如何在MVC.NET视图中从库继承,asp.net-mvc,ckfinder,Asp.net Mvc,Ckfinder,我试图在我的MVC.Net网站中实现CKFinder,但是默认设置仅适用于常规asp.Net网站,因此我尝试将其更改为正常 一页从库CKFinder.Connector.Connector继承。在过去,我的aspx只能继承CKFinder.Connector.Connector,但是在MVC.NET中是如何做到的呢 Inherits=“System.Web.Mvc.ViewPage”是否相同?Inherits=“System.Web.Mvc.ViewPage”会将CKFinder.Connect
Inherits=“System.Web.Mvc.ViewPage”
是否相同?Inherits=“System.Web.Mvc.ViewPage”
会将CKFinder.Connector.Connector设置为视图页面的强类型模型对象。如果您试图使用
语法访问标记中的连接器实例的属性,这将对您有效
相反,如果需要引用CKFinder.Connector.Connector作为命名空间,则需要在页面指令下方和任何标记之前添加以下行:
<%@ Import Namespace="CKFinder.Connector.Connector" %>
Inherits=“System.Web.Mvc.ViewPage”
会将CKFinder.Connector.Connector设置为视图页面的强类型模型对象。如果您试图使用
语法访问标记中的连接器实例的属性,这将对您有效
相反,如果需要引用CKFinder.Connector.Connector作为命名空间,则需要在页面指令下方和任何标记之前添加以下行:
<%@ Import Namespace="CKFinder.Connector.Connector" %>
< /代码> 如果频繁使用这个命名空间,您应该考虑将其添加到<代码> VIEWS/Web.CONFIG文件中的命名空间节点。
这确保所有页面都可以访问此命名空间,并且intellisense也将可用。这一点也在本文中进行了讨论
XML结构如下所示
<configuration>
<system.web>
<pages>
<namespaces>
<add namespace="CKFinder.Connector.Connector" /> <!-- <<< Your entry here -->
</namespaces>
</pages>
</system.web>
</configuration>
<> > <代码>命名空间< /代码>节点可能不存在,因此您应该在<代码>页< /COD>节点(应该存在)内添加它。 如果频繁使用此命名空间,则应该考虑将其添加到文件>中的命名空间节点。
这确保所有页面都可以访问此命名空间,并且intellisense也将可用。这一点也在本文中进行了讨论
XML结构如下所示
<configuration>
<system.web>
<pages>
<namespaces>
<add namespace="CKFinder.Connector.Connector" /> <!-- <<< Your entry here -->
</namespaces>
</pages>
</system.web>
</configuration>
名称空间
节点可能不存在,因此您应该将其添加到页面
节点(应该存在)中