Geeks With Blogs
Bob Goedkoop Programming C# on Microsoft's .NET plaform

Technorati Tags: ,,,,
Starting from MVC 3 and up this issue has been addressed. From MVC 3 and up underscores in HTML attributes are automatically converted to dashes.

Here’s an example:

@Html.TextBox( "tbxOne", "", new { @data_id = "someId", @style= "width:120px; text-align:right;" })

This wil result in:

<input data-id="someId" name="tbxOne" type="text" value="" />
Posted on Wednesday, July 3, 2013 1:02 PM C# , MVC | Back to top


Comments on this post: Using data-* attributes in ASP.NET MVC

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Bob Goedkoop | Powered by: GeeksWithBlogs.net