Wednesday, 15 September 2010

javascript - How to display name and POST value with MVC TextBox helper? -



javascript - How to display name and POST value with MVC TextBox helper? -

i have textbox. model alsway include username.

@html.textboxfor(model => model.userid, new { @class = "floatleft" })

i want dipslay username, post userid modelbinder when posting. there way tell textbox display , utilize when passing info server?

i suggest adding hidden input , setting it's value userid if need value in view/form not needing editable.

<input type="hidden" name="userid" value="@model.userid" />

i wrote manually because posts, have had mixed issues using @html.hiddenfor() under conditions.

i did forget alter textbox:

@html.textboxfor(model => model.username, new { @class = "floatleft" })

javascript jquery asp.net-mvc razor html-helper

No comments:

Post a Comment