1
我有一個使用Devexpress控件的MVC3應用程序。強類型視圖中的錯誤
我的第一頁工作正常,但這不是強類型。
我得到的錯誤「BC30451:‘ViewData的’未聲明它可能無法訪問由於其保護級別」我的第二頁上的開頭爲:
@ModelType IEnumerable(Of MyModel.XXX)
@Code
ViewBag.Title = "Index"
End Code
<h2>Index</h2>
產生的VB代碼System.Web.Mvc.WebViewPage
繼承。 進口有問題嗎?
#ExternalChecksum("C:\Work\XXX\Views\FahrzeugMarke\Index.vbhtml","{406ea660-64cf-4c82-b6f0-42d48172a799}","A585D67D9E053939A220E5FDCF169863")
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.235
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports DevExpress.Utils
Imports DevExpress.Web.ASPxCallbackPanel
Imports DevExpress.Web.ASPxClasses
Imports DevExpress.Web.ASPxEditors
Imports DevExpress.Web.ASPxGridView
Imports DevExpress.Web.ASPxHtmlEditor
Imports DevExpress.Web.ASPxMenu
Imports DevExpress.Web.ASPxNavBar
Imports DevExpress.Web.ASPxPopupControl
Imports DevExpress.Web.ASPxRoundPanel
Imports DevExpress.Web.ASPxSpellChecker
Imports DevExpress.Web.ASPxSplitter
Imports DevExpress.Web.ASPxTabControl
Imports DevExpress.Web.ASPxTreeView
Imports DevExpress.Web.ASPxUploadControl
Imports DevExpress.Web.Mvc
Imports DevExpress.Web.Mvc.UI
Imports MvcMiniProfiler
Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Net
Imports System.Web
Imports System.Web.Helpers
Imports System.Web.Mvc
Imports System.Web.Mvc.Ajax
Imports System.Web.Mvc.Html
Imports System.Web.Routing
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.WebPages
Namespace ASP
Public Class _Page_Views_FahrzeugMarke_Index_vbhtml
Inherits System.Web.Mvc.WebViewPage(Of IEnumerable(Of myModel.XXX))
Public Sub New()
MyBase.New
End Sub
Protected ReadOnly Property ApplicationInstance() As ASP.global_asax
Get
Return CType(Context.ApplicationInstance,ASP.global_asax)
End Get
End Property
Public Overrides Sub Execute()
WriteLiteral(""&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10))
#ExternalSource("C:\Work\XXX\Index.vbhtml",3)
ViewBag.Title = "Index"
PS:如果我刪除ViewBag.Title =「索引」行,我得到一個錯誤的「HTML不明確」,因爲它是在系統中定義。 Web.WebPages和System.Web.Mvc都被導入 –