在asp.net MVC 3中单击多个按钮 [英] multiple button click in asp.net MVC 3

查看:110
本文介绍了在asp.net MVC 3中单击多个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的asp.net mvc 3页面上有多个动态按钮.在asp.net mvc 3中处理按钮单击的最佳方法是什么?在asp.net中没有事件处理,因此,最佳实践是什么.

I am having multiple dynamic buttons on my asp.net mvc 3 page. what is the best way to handle button click in asp.net mvc 3? there is no event handling in asp.net, so what is the best practice to hadle.?

推荐答案

如果按钮不需要相同的表单数据,则可以使用不同的操作方法创建两个表单.这是最简单的解决方案.

If the buttons do not require the same form data, then you can create two forms with different action methods. This is the easiest solution.

如果需要使用相同的表单数据,则可以使用多种方法,包括Darin和tvanfosson的方法.还有一种基于属性的方法,可以根据单击的按钮选择正确的操作方法.

If you need to use the same form data, then there are a number of methods, inclduing Darin and tvanfosson's approaches. There is also an approach based on attributes that will select the correct action method based on which button is clicked.

http://www.dotnetcurry.com/ShowArticle.aspx?ID=724

这篇关于在asp.net MVC 3中单击多个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆