asp.net mvc - Data annotations for input fields with out html helper methods -



asp.net mvc - Data annotations for input fields with out html helper methods -

i want bind info annotations input fields not interested utilize html helpers render form. can 1 suggest how bind info annotations plain html input fields out using html helper methods.

@html.textboxfor(model => model.username)

it automatically binds validation rule text box written required @ model class want same thing if write like

<input type="text" name="username"/>

in must validate through info annotation.

the html attributes decorate model/view model referenced via models modelmetadata object. writing plain html you're not going able access info you're writing straight html.

there's not much of way around this, though if force came shove alternative be:

write means of turning modelmetadata json object , add together necessary attributes associative html input field, using name reference property such name="model.username".

out of interest, why determind not utilize html helpers? happy write own html helpers?

html asp.net-mvc asp.net-mvc-4 c#-4.0

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -