when you use HtmlHelpers in MVC, you can specify a set of html attributes a a dictionary objects.
I read online a lot of material about creating HtmlHelpers but I am already focusing on jQuery and other ASP.NET stuff for an application that I have to develop ASAP and I do not have time to take care of Html Helpers customization as well.
I know that there are some attributes made already available by MVC3 like @class, but in the Microsoft website there is no information about the htmlattributes. May you please tell me which attributes are available and how I can specify themin C#?
I am mostly interested in the “disable”,to disable a specific control, and “id”, to change the id of a control, because the HtmlHelpers for default use the same value for id and name. I need it to use them with jQuery.
Thanks in advance
Francesco
Those are simple HTML attributes, so you could use any attribute available in the DOCTYPE you are using. ASP.NET MVC helpers simply take those attributes and emit them in the resulting HTML page. So if you need a documentation take a look at the HTML specification.
There is just a little remark about HTML5
data-*attributes which contain dashes. Because dashes cannot be used as variable names in .NET you could use underscore which will be converted to a dash. Example:which will be rendered as: