I see the DisplayAttribute
has a ShortName
property, but I see no Html.ShortName
helper. How can I get to use this short name for my table column headings? Do I have to write my own helper?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
- Install ASP.NET 5.0 version of System.ServiceModel
相关文章
- MVC CDN fallback for Style Bundle
- Add to htmlAttributes for custom ActionLink helper
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
For me the accepted answer didn't help much because my view model was defined as an IEnumerable:
And so I needed a DisplayShortNameFor version of the existing extension method:
I was able to find one in here:
Not sure if it is the best approach but it worked fine for me.
You could write your own helper :
Something like
But, from msdn :
So it looks like it should be automatic (when no room enough), but... untested here. Sounds like it should work with @Html.LabelFor in this way.