Model Binding With Disabled Textbox

前端 未结 7 2035
余生分开走
余生分开走 2020-12-09 07:23

I have a textbox that I am defining as

<%= Html.TextBox(\"Username\", Model.Form.Username, 
        new { @class = \"textbox\", @disabled = \"disabled\" }         


        
7条回答
  •  伪装坚强ぢ
    2020-12-09 07:57

    You can do a workaround by adding a hidden field with the same value ;)

    <%= Html.Hidden("Username", Model.Form.Username)%>
    

提交回复
热议问题