Zack Peterson
Zack Peterson

Reputation: 57373

ASP.NET error BC30456: 'Title' is not a member of 'ASP.views_controllername_viewname_aspx'

My ASP.NET MVC application fails with this error:

BC30456: 'Title' is not a member of 'ASP.views_controllername_viewname_aspx'.

But, Title doesn't appear anywhere except the first line of my View.

<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of SomeThing)" %>

Upvotes: 1

Views: 7334

Answers (3)

Wizzarding
Wizzarding

Reputation: 81

I get this all the time, but my solution is not one of those already supplied, so here it is for anyone else getting the same problem.

Check to make sure you are passing your model to the view from the controller method: Return View(Model)

instead of: Return View()

I find this causes the BC30456 error when the view is expecting a list of entities, something like: ... Inherits="System.Web.Mvc.ViewPage(Of IEnumerable (Of Mydata.DataEntity))"

Almost for got the other solution! Make sure your web.config file has an entry for system.data.entities in system.web, compilation, assemblies. The following example is taken from a MVC2 Framework 4 project:

...

Hope that helps someone!

Upvotes: 1

P-H
P-H

Reputation: 43

I've had this problem in a MVC application that reference entities from another project. The solution was to add the assembly in web.config

< add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Thought I post in case someone else runs into the same problem.

Upvotes: 3

Zack Peterson
Zack Peterson

Reputation: 57373

My strongly-typed view was of a non-existant type. I had changed the object's name.

<%@ Page ... Inherits="System.Web.Mvc.ViewPage(Of CorrectThing)" %>

vs.

<%@ Page ... Inherits="System.Web.Mvc.ViewPage(Of WrongThing)" %>

Upvotes: 4

Related Questions