Skip to content
欢迎扫码关注公众号

List 视图的 Header 部如何使用 LabelFor 显示 DisplayAttribute 值?

默认创建的 List 视图的行头是固定文字,而不是通过 LabelFor 动态实现的。

因为 List 视图绑定的强类型是 IEnumerable<XxxModel>,而不是具体的 Model,不能使用 @Html.LabelFor(m => m.Property) 显示属性的名称。但是可以变通一下改成如下的形式就可以实现想要的效果:@Html.LabelFor(m => Model.FirstOrDefault().Property)

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.