CS0103 C#AND ASP.net当前上下文中不存在名称“模型”

时间:2019-03-26 15:44:29

标签: c# .net razor

我有一个名为date.cshtml的文件。
 date.cshtml代码

   @model DateTime? 
   @(Html.Kendo().DatePickerFor(m => m))

@model出现错误。 date.cshtml文件在razor文件夹下。如何解决此问题。任何链接或任何文档都将有所帮助。有关更多详细信息,我附加了web.config代码

Web.config

   <?xml version="1.0" encoding="utf-8"?>
   <configuration>
   <configSections>
   <sectionGroup name="system.web.webPages.razor"   type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
   <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
   </sectionGroup>
   </configSections>
   <system.web.webPages.razor>
   <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <pages pageBaseType="System.Web.Mvc.WebViewPage">
   <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization" />
    <add namespace="System.Web.Routing" />

    <add namespace="MvcSiteMapProvider.Web.Html" />
    <add namespace="MvcSiteMapProvider.Web.Html.Models" />
   </namespaces>
   </pages>
   </system.web.webPages.razor>
   <appSettings>
   <add key="webpages:Enabled" value="false" />
   </appSettings>
   <system.web>
   <httpHandlers>
   <add path="*" verb="*" type="System.Web.HttpNotFoundHandler" />
   </httpHandlers>

   <pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
   <controls>
    <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
   </controls>
   </pages>
   </system.web>
   <system.webServer>
   <validation validateIntegratedModeConfiguration="false" />
   <handlers>
   <remove name="BlockViewHandler" />
   <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
   </handlers>
   </system.webServer>
   </configuration>

请帮助

0 个答案:

没有答案