2013-10-16 147 views
0

我非常新的ASP.NET MVC 2登录屏幕2

我试图让简单的登录屏幕从Custom Login Screen(该教程是MVC 4)

这是我的登录视图和其余模型和控制器与链接示例中描述的相同。

<div class="editor-label"> 
      <%=Html.LabelFor(u => u.UserName)%> 
     </div> 
     <div class="editor-field"> 
      <%=Html.TextBoxFor(u => u.UserName)%> 
      <%=Html.ValidationMessageFor(u => u.UserName)%> 
     </div> 

    <input type="submit" value="Log In" /> 

如何将它与模型和控制器链接?

如果您使用剃刀作为视图引擎请帮

+0

我认为该解决方案已经有一个'BeginForm()'。那么你的问题到底是什么?它应该按照您提供的解决方案链接提供的方式工作。 – Nilesh

回答

1

您可以使用BIOS

在第一种方法与 submit类型的任何按钮给出

答案将调用在

定义的操作
<% using (Html.BeginForm("Action", "Controller", null, FormMethod.Post, new {@id = "value")) {%> 

同样适用<form method="post" action="/Controller/Action">

1

尝试Html.BeginForm()表单提交。

例子:

<% using (Html.BeginForm("Action", "Controller", null, FormMethod.Post, new {@id = "value")) {%> 

//Your form goes here 

<% } %> 

或者

<form method="post" action="/Controller/Action"> 
    //Your form goes here 
</form>