开发者

ASP.NET MVC Template Helpers - How to Get Lower case ID's

When using the template helpers in ASP.NET MVC, e.g. Html.EditorFor(x => x.Property) the rendered Html with have a capitalized ID - matching my property name.

In order to standardize the ID's of all html elements I want this to be lower case. Rather than specifying the ID manually - which won't get updated if I rename my property, I'd like to establish a convention.

I'm sure I read this was possible somewhere and I'm currently scanning the interwebz to find it. But if anyone can help m开发者_StackOverflow社区e and save me time, that would be awesome.


Currently ASP.NET MVC doesn't offer any extension points allowing you to do this.


You could extend the Html.EditorFor; this tutorial can get you started.

Or you use this:

Html.EditorFor(x => x.Property).ToString().ToLower()
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜