有多个不同的MVC剃刀形式提交按钮? [英] MVC razor form with multiple different submit buttons?
本文介绍了有多个不同的MVC剃刀形式提交按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
剃刀视图有一个表单内3个按键。所有按钮的动作都需要哪些基本都值来输入字段格式值。
A Razor view has 3 buttons inside a form. All button's actions will need form values which are basically values coming input fields.
每当我点击任何它重定向我默认操作的按钮。可否请您指导我如何可以提交表单,基于按钮preSS不同的操作?
Every time I click any of buttons it redirected me to default action. Can you please guide how I can submit form to different actions based on button press ?
我真的AP preciate你的时间,指导和帮助。
I really appreciate your time, guidance and help.
推荐答案
ü也可以尝试这样的:
<input type="submit" name="submitbutton1" value="submit1" />
<input type="submit" name="submitbutton2" value="submit2" />
然后在你的默认功能,你叫你想要的功能:
Then in your default function you call the functions you want:
if( Request.Form["submitbutton1"] != null)
{
// Code for function 1
}
else if(Request.Form["submitButton2"] != null )
{
// code for function 2
}
这篇关于有多个不同的MVC剃刀形式提交按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文