asp.net mvc - add data to my html mvc part -


it such have add data-val used birthday indicating when have fødelsedag. have check add plain html mvc html part, have tried this.

it causes problems @ 2 using data-* , can not pardon enter it.

 @html.textbox("txtfornavn", null, new  {   @class = "form-control input-lg",   placeholder = "fornavn",   data-val="true",   data-val-required="date required",   type = "date"  }) 

normally, html part this.

<input type="date" class="form-control input-lg" data-val="true" data-val-required="date required"> 

i have written here, , works fine out problems.¨

 @html.textbox("txtfornavn", null, new   {    @class = "form-control input-lg",    placeholder = "fornavn",    type = "date"   }) 

i have try here:

html5 data-* asp.net mvc textboxfor html attributes

the link posted gave answer. have use underscore _ if want use dashes in attribute name

 @html.textbox("txtfornavn", null, new  {   @class = "form-control input-lg",   placeholder = "fornavn",   data_val="true",   data_val_required="date required",   type = "date"  }) 

did try that?


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -