Il Html.TextBox
sintassi è:Come aggiungere l'attributo di dati html5 a Html.TextBox in asp.net mvc?
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name,
object value, object htmlAttributes);
Così, ho messo il mio attributo dati in htmlAttributes
. Ho provato
@Html.TextBox("date",Model.Date,new { data-myid="aaa"})
ma questo non funziona per me.
+1 Anche se si aggiunge 'data_my_id_attribute' verrà convertito l'intera a' dati-my-id-attribute'! –