Text box default value in Razor syntax
问题 <div class="editor-label"> @Html.LabelFor(model => model.UserName) </div> <div class="editor-field"> @Html.EditorFor(model => model.AccountModel.UserName) @Html.ValidationMessageFor(model => model.AccountModel.UserName) </div> On this page load (View load), I would like the Username text box to have its value automatically populated from the standard aspnet membership informtion. How can assign this default value to the text box. Please help. thank you 回答1: In your controller action you could