MayHnin
MayHnin

Reputation: 29

c# mvc.net - One or more multiple form action in cshtml?

Please see the picture.

I have three actions. (Remove the class, Reserve the class and Add more classes)

Can I use one or more multiple form action in cshtml?

Upvotes: 0

Views: 382

Answers (1)

Willy David Jr
Willy David Jr

Reputation: 9151

Yes. In order to call them in View:

<input type="button" value="Remove Button Name" onclick="location.href='@Url.Action("ActionName", "ControllerName", new { yourParameterHere= 'ValueOfYourParameter' })'" />

Basically your ActionName would be the name of your Action = "Remove" for example.

Your Parameter name would be the parameter name that you will be receiving in your ActionName for example:

public ActionResult Remove(int intRemoveID) //intRemoveID would be your parametername
    {
        return View();
    }

This should be the same on other buttons as well. Let me know if you need clarifications.

Upvotes: 1

Related Questions