开发者

How do I control the DisplayForModel method in ASP.NET MVC 2?

开发者 https://www.devze.com 2022-12-30 00:58 出处:网络
If I use DisplayForModel in a strongly-开发者_开发问答typed ASP.NET MVC 2 View with an EntityObject model, then unwanted field labels are displayed:

If I use DisplayForModel in a strongly-开发者_开发问答typed ASP.NET MVC 2 View with an EntityObject model, then unwanted field labels are displayed:

  • EntityState
  • EntityKey

How can I control the output to hide these?


Personally I would create a view specific presentation model with only the fields I wanted to display.

If you haven't already seen the blog post series from Brad Wilson on display templates, I would recommend reading over them.

In part 2 he mentions the ShowForDisplay piece of metadata, but I couldn't find where to set or manipulate it.

HTHs,
Charles

0

精彩评论

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