top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can you handle multiple submit buttons?

+1 vote
359 views
How can you handle multiple submit buttons?
posted Dec 29, 2014 by Rahul Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The cleanest way would be to add two forms on your page - one for login and one for registration. It should look something like:

   using (Html.BeginForm("Login", new { action = "Login", controller = "Account"}, FormMethod.Post)) {
    @Html.LabelFor(m => m.Username)
    @Html.TextBoxFor(m => m.Username)

    @Html.LabelFor(m => m.Password)
    @Html.PasswordFor(m => m.Password)

    <input type="submit" />
    }

.

using (Html.BeginForm("Register", new { action = "Register", controller = "Account"}, FormMethod.Post)) {
@Html.LabelFor(m => m.Username)
@Html.TextBoxFor(m => m.Username)

@Html.LabelFor(m => m.Password)
@Html.PasswordFor(m => m.Password)

@Html.LabelFor(m => m.Confirm)
@Html.PasswordFor(m => m.Confirm)

<input type="submit" />
}

For more informmation plz refer link: http://www.andrewdenhertog.com/asp-net/using-multiple-submit-buttons-in-an-html-form-in-asp-net-mvc/

answer Jan 3, 2015 by Vrije Mani Upadhyay
Similar Questions
+2 votes

Is it possible use two ( multiple) models with a single view? If yes How?

+4 votes

When using razor views, do you have to take any special steps to proctect your asp.net mvc application from cross site scripting (XSS) attacks?

...