asp.net mvc自定义ViewPage、textbox用于抛出异常
我有自定义视图页面,如下所示。
public abstract class CustomViewPage : WebViewPage
{
}
public abstract class CustomViewPage<T> : CustomViewPage where T : class
{
}
这是我的客户类别
public class Customer
{
public string Title { get; set; }
}
现在在我的index.cshtml
@model SomeNameSpace.Customer
@{ ViewBag.Title = "首页"; }
@ViewBag.Message
@Html.TextBoxFor(m => m.Title)
我已更改 web.config 以通过此设置使用我的客户自定义视图页面
当导航到主页时,它会抛出异常
CS1061:“object”不包含“Title”的定义,并且找不到接受“object”类型的第一个参数的扩展方法“Title”(您是否缺少 using 指令或装配参考?)
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 Title { 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?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了,
Solved,