asp.net mvc - Add html5 date attribute -
this question has reply here:
html5 data-* asp.net mvc textboxfor html attributes 1 replyhow can add together html5 info attribute mvc editorfor field. know can add together attributes this:
@html.editorfor(p => model.test, new { disabled = "disabled"})
but when want same data-* attribute, right html5 syntax elements error! example:
@html.editorfor(p => model.test, new { data-test= "test" })
this errors i'm recieving
invalid anonymous type fellow member declarator. anonymous type members must declared fellow member assignment, simple name or fellow member access.
the name 'data' not exist in current context
the name 'test' not exist in current context
editorfor
not take htmlattributes
parameter. sec parameter, additional view data. in other words, members of anonymous object pass there simply added the viewdata
dictionary, i.e. viewdata["disabled"] == "disabled"
. in custom editor template can utilize these values generate html or whatever, none of happens automatically.
asp.net-mvc html5 model-view-controller html5-data
No comments:
Post a Comment