Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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......!?
Posted
Updated 18-Jun-12 4:22am
v2
Comments
Sergey Alexandrovich Kryukov 18-Jun-12 13:54pm    
ASP.NET? Tag it.
--SA
Sergey Alexandrovich Kryukov 18-Jun-12 13:56pm    
Clicked -- a key or a button (control)?
--SA

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Jun-12 13:53pm    
Do you think this example is good? To me, it looks like the manual on how not to do programming. (I did not vote.)
--SA
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.
C#
protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
{
      string s = ((WebControl)sourceControl).ID;
      Response.Write(s.ToUpper());
}

Thanx & Regards
 
Share this answer
 
v2
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900