开发者

asp.net mvc custom ViewPage, textboxfor throwing exception

开发者 https://www.devze.com 2023-03-30 10:37 出处:网络
I have custom View page like given below. publicabstract class CustomViewPage : WebViewPage { } public abstractclass CustomViewPage<T> : CustomViewPage where T : class

I have custom View page like given below.

public  abstract class CustomViewPage : WebViewPage
{

}

public abstract  class CustomViewPage<T> : CustomViewPage where T : class
{

}

here is my customer class

public class Customer
{
    public string Ti开发者_如何学Gotle { get; set; }
}

Now on my index.cshtml

@model SomeNameSpace.Customer

@{ ViewBag.Title = "Home Page"; }

@ViewBag.Message

@Html.TextBoxFor(m => m.Title)

I have changed the web.config to use my custome customviewpage by this setting

When the navigate to home page it throws an exception

CS1061: 'object' does not contain a definition for 'Title' and no extension method 'Title' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)


Solved,

public abstract  class CustomViewPage<T> : ViewPage<T> where T : class
{

}
0

精彩评论

暂无评论...
验证码 换一张
取 消