asp.net mvc custom ViewPage, textboxfor throwing exception
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
{
}
精彩评论