当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How to get data from @html.encode() and pass to @html.editorfor()?

问题描述:

@Html.Encode(User.Identity.Name)

Above this is in MVC 4 Razor view html Helper method control. it exists in _Layout.cshtml file and I want to get the User name from this Control and want to set it in html HtmlHelper method control which is below.

@Html.EditorFor(model => model.UserName)

But both views have their separate Models so how can I get User name and pass it into

@Html.EditorFor(model => model.UserName)

and when I Click save button it should save in Database.

Any help would be appreciate.

分享给朋友:
您可能感兴趣的文章:
随机阅读: