在我的 ASP.NET MVC 3 应用程序中有以下视图模型,我有一个问题描述如下:
public class MyViewModel : ViewModelBase
{
  // having this line kills the one below it, while commenting it out solves the problem. WHY?
  [DataType(DataType.Text)]
  [Display(Name = "Name", Description = "Description", Prompt = "Prompt"]
  public new string MyField { get; set; }
}
一旦我注释掉,[DataType(DataType.Text)]我就可以看到所有其他的东西出现,但如果一起使用,DataType.Text 有点覆盖它下面的东西(至少看起来像这样)。
为什么会发生这种情况以及如何解决?
提前致谢。