简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM