我有第一种形式的用户名和密码,并以另一种形式检索密码,我希望在提交第二种形式时以第一种形式输入用户名。
@model Network.Models.LoginDetail
<script type="text/javascript">
</script>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<p>
Please enter your user name and password. @Html.ActionLink("Register", "Register") if you don't have an account.
</p>
@using (Html.BeginForm("Index","Student",FormMethod.Post)) {
<div>
<fieldset>
<legend>Account Information</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Username)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Username)
@Html.ValidationMessageFor(model => model.Username)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Password)
@Html.ValidationMessageFor(model => model.Password)
</div>
<p>
<input type="submit" value="Log in" style="width: 200px"/>
</p>
@ViewBag.Message
</fieldset>
</div>
}
@using (Html.BeginForm("RetrievePassword","Student",FormMethod.Post)) {
<p>
Forgot password? <input type="submit" onclick="updateUsername();"value="Click Here" style="width: 150px"/> Entering your username to retrieve your password.
</p>
@Html.HiddenFor(model => model.Username)
}
我们如何才能做到这一点,我尝试在隐藏字段中捕获用户名的 javascript 但不起作用。或者可以使用形式中的形式来实现这一点。请提供解决方案。
谢谢,
迈克尔德