无法从System.Web.Mvc.ViewPage <dynamic>获取aspx中的Model

时间:2017-07-05 10:57:15

标签: asp.net

我想在aspx页面中获取模型。我怎么才能得到它。我在配置文件中需要做什么?请帮助我。

<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="Report.aspx.cs" 
 Inherits="IBATechnologies.IBA.Main.Views.Report" %>
 <%@ page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
 <!DOCTYPE html>

 <html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
   <title></title>
   <script runat="server">
    Model // here i cant find Model "the name Model is not in current 
   context"
    </script>

</head>
 <body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

我不确定,但您可以使用DynamicViewPage而不是ViewPage。

可能是这个链接会帮助你。 https://docs.microsoft.com/en-us/aspnet/mvc/overview/views/dynamic-v-strongly-typed-views