Setting default value for @Html.EditorFor in ASP.NET MVC -


hi i'm trying set value @html.editorfor in view razor engine.

but value not displaying in browser when run application. issue?

here editor:

@html.editorfor(model => model.firstname, new {  @value = "divaya sree" }) 

the best way initialize model in controller , pass model view

model.firstname = "divaya sree"; return view(model); 

now can use

@html.editorfor(model => model.firstname) 

or work

@html.textboxfor(c => c.firstname, new { @value = "divaya sree" }) 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -