我是 MVC 的新手,我正在为我的应用程序创建一个注册表单,但是我的按钮单击不起作用,下面没有给出当前代码
看法
<fieldset>
<legend>Sign Up</legend>
<table>
<tr>
<td>
@Html.Label("User Name")
</td>
<td>
@Html.TextBoxFor(account => account.Username)
</td>
</tr>
<tr>
<td>
@Html.Label("Email")
</td>
<td>
@Html.TextBoxFor(account => account.Email)
</td>
</tr>
<tr>
<td>
@Html.Label("Password")
</td>
<td>
@Html.TextBoxFor(account => account.Password)
</td>
</tr>
<tr>
<td>
@Html.Label("Confirm Password")
</td>
<td>
@Html.Password("txtPassword")
</td>
</tr>
<tr>
<td>
<input type="submit" name="btnSubmit" value="Sign Up" />
</td>
</tr>
</table>
</fieldset>
模型
public class Account
{
public string Username { get; set; }
public string Email { get; set; }
public string Password { get; set; }
}
控制器(未完全完成)
public class AccountController : Controller
{
//
// GET: /Account/
public ActionResult Index()
{
return View();
}
// GET: /Account/SignUp
public ActionResult SignUp()
{
return View();
}
[HttpPost]
public ActionResult SignUp(string userName,string email,string password)
{
Account createAccount = new Account();
createAccount.Username = userName;
createAccount.Email = email;
createAccount.Password = password;
return View("Index");
}
}
如何在这里定义点击事件我尝试了http帖子但它不起作用我知道我的代码不正确请指出这里的错误是什么