我怎么知道点击了哪个按钮 [英] how can i know which button is clicked

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

问题描述

亲爱的,
我有一个Web应用程序,我需要知道单击了哪个按钮.
当用户单击添加时,会出现一个弹出窗口,并要求按他想要的任何按钮或字母(允许所有键Ctrl,Alt,Esc,Tab,Home,数字和字符),然后我需要从键盘上获取被单击的键发起特别活动.

任何帮助......!?

Dears,
i have a web application and i need to know which button is clicked.
when the user click add, a popup appears and ask to press any button or letter (all keys allowed Ctrl,Alt,Esc,Tab,Home,Numbers and characters ) he want, and then i need to get the clicked key from keyboard to fire a special event.

any help......!?

推荐答案



ASP.NET上的一个很好的例子:

http://wiki.asp.net/page .aspx/1207/capturing-key-strokes-and-doing-a-post-back/ [
Hi,

a great example on ASP.NET:

http://wiki.asp.net/page.aspx/1207/capturing-key-strokes-and-doing-a-post-back/[^]

Regards



对于您的问题,此解决方案将是更好的选择...单击了哪个按钮.为此,您需要重写一个方法,即RaisePostBackEvent
这会告诉你.我已经尝试过了.试试吧.
Hi,
This solution will be better for u for the problem... On which button has been clicked. For this u have to need override a method i.e. RaisePostBackEvent
which will tell u. i have tried it. try it.
protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
{
      string s = ((WebControl)sourceControl).ID;
      Response.Write(s.ToUpper());
}


谢谢关于


Thanx & Regards


整个想法是错误的.所有面向偶数的UI都不基于检查事件是否已发生以及发送方是哪个控件,而是基于为控件提供适当的事件处理程序.
请参阅我对该问题的评论-尚不清楚应检测到什么.就像我说的那样,不必检测发件人,并且可以将按下的键作为事件参数传递.

—SA
The whole idea is wrong. All the even-oriented UI are based not on checking up if the event has happened and what control is the sender, but rather on providing an appropriate event handler for a control.

Please see my comment to the question — it is not clear what should be detected. As I say, a sender does not have to be detected, and a key pressed is passed as an event parameter.

—SA


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

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