You can create data- HTML attributes with your controls using this technique.
Define a new HTML Attributes anonymous object with your Html helpers. Below, I create a text box with some additional properties I want to be able to access with jQuery. Using properties that start with “data_”, you will be able to access the property with jquery’s data() method. Note: using property names that start with “data-” will result in a compilation error.
This is the HTML that gets rendered
Here is what jquery’s data() method converts property names to. Interestingly, the underscores are removed and camel casing is applied to the name.
Here is another good article on the subject.