Cancel button in form

后端 未结 9 2300
借酒劲吻你
借酒劲吻你 2021-02-05 14:28

I have a cancel button in a form:

@using (Html.BeginForm(\"ConfirmBid\",\"Auction\"))
        {
          some stuff ...

                    

        
9条回答
  •  自闭症患者
    2021-02-05 14:43

    Either you can convert the Cancel button as an anchor tag with @Html.ActionLink helper method and apply a css class which makes the link to looks like a button and then in the controller action for that link, you can return the specific view.

    @Html.ActionLink("Cancel","Index","Products",null, new { @class="clsButtonFake"})
    

    or

    Use 2 submit buttons in the form. One for real submit and one for the cancel. and in your controller action, check which button called the action method. You can read more about it here in this answer.

提交回复
热议问题