c# - Unable to display view page using ASP.NET MVC2 -
i getting following error while trying display data in view page using asp.net mvc2.
error:
server error in '/' application. compilation error description: error occurred during compilation of resource required service request. please review following specific error details , modify source code appropriately. compiler error message: cs0234: type or namespace name 'person' not exist in namespace 'test3.models' (are missing assembly reference?) source error: line 170: line 171: [system.runtime.compilerservices.compilerglobalscopeattribute()] line 172: public class views_home_index_aspx : system.web.mvc.viewpage<test3.models.person>, system.web.sessionstate.irequiressessionstate, system.web.ihttphandler { line 173: line 174: private static bool @__initialized; source file: c:\windows\microsoft.net\framework\v4.0.30319\temporary asp.net files\root\86f20dd8\a41e18c\app_web_index.aspx.a8d08dba.z89z2bzv.0.cs line: 172
my code files given below.
index.aspx:
<%@ page language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage<test3.models.person>" %> <asp:content id="content1" contentplaceholderid="titlecontent" runat="server"> home page </asp:content> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <h2><%: viewdata["message"] %></h2> <p><% html.textboxfor(model=> model.name); %>html</p> <p> learn more asp.net mvc visit <a href="http://asp.net/mvc" title="asp.net mvc website">http://asp.net/mvc</a>. </p> </asp:content>
person.cs
using system; using system.collections.generic; using system.linq; using system.web; namespace test3.models { public class person { public string name { get; set; }; } }
homecontroller.cs
using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; using test3.models; namespace test3.controllers { [handleerror] public class homecontroller : controller { public actionresult index() { viewdata["message"] = "welcome asp.net mvc!"; person p = new person(); p.name = "subhrajyoti"; return view(p); } public actionresult about() { return view(); } } }
when running using ctrl+f5
got above error.please me resolve error.
is test3 separate project project executed? if case, check project assembly linkage , verify target framework of projects involved same resolve problem. hope helps.
Comments
Post a Comment