关于按钮点击的问题 [英] Question on Button Clicks

查看:58
本文介绍了关于按钮点击的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我牢记这个逻辑/计划,并想对如何实施提出一些建议.我对此进行了很多研究,但找不到适合我的情况的合适的.我的.aspx代码中有几个Button,并且想要检查这些按钮的countClicks.因此,有没有一种方法可以使用后面的代码(即在.cs中编写代码)而不是在javascript中编写计数点击来检查按钮计数点击?我正在做的是限制用户单击2个以上的按钮(他们最多只能单击5个可用按钮中的2个按钮).

我为每一个添加了

I have this logic/plan in mind and would like to have some advice on how to implement it. I have researched alot on it but could not find a suitable one that suit my context. I have a few Buttons in my .aspx code and would like to check for countClicks for those buttons. Therefore, is there a method to check for button count clicks using code behind (meaning writing codes in the .cs) instead of writing count clicks in javascript? What i am doing is to restrict the user from clicking more than 2 buttons (they can only click a maximum of 2 buttons out of the 5 buttons available).

I included a

commandName = "Select"

5个按钮中的一个,以检查用户按下的按钮数量.我在正确的轨道上吗?
我该如何实现这一目标?

感谢您的帮助!

for each of the 5 buttons in order to check the number of button click the user presses. Am i on the right track?
How do i go about achieving this?

Thanks for your help!

推荐答案

一些建议

1 .只需在单击后禁用按钮....如果禁用了两个以上的按钮,则提示用户.
2 .使用隐藏字段或viewstate保持按钮点击计数,并从后面的代码中更新点击计数...检查viewstate/hiddenfield中的计数,然后提示用户使用它的两个以上/> 3 .使用复选框而不是按钮,以便用户可以选择撤消选择
Some Suggestion

1.Just disable the button after click....if more than two buttons are disabled then prompt to user.
2.Use a hiddenfield or viewstate to keep the button click count and update the click count from code behind... Check for the count in viewstate/hiddenfield then prompt to user it its more than two
3. Use Check Boxes instead of Button so that user have the option to undo the selection


这篇关于关于按钮点击的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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