Thursday, December 24, 2009

I want to write coding in c# for event handling in a web page.?







protected override void OnKeyDown(KeyDownArgs e)


{


my_keydown(e);


base.OnKeyDown(e);


}





void my_keydown(KeyDownArgs e)


{


if (e.KeyCode.Equals(Keys.Escape))


{


MessageBox.Show(';You pressed escape';);


}





if (e.Alt %26amp;%26amp; e.KeyCode == Keys.A)


{


MessageBox.Show(';Alt + A';);


}


}








the above coding is for the System.windows.form


How am i to change it to my web page? where will i get codings for the same?I want to write coding in c# for event handling in a web page.?
You will have to write JavaScript code for the same code as Forms are not the same as Web pages. The client click and key press are handled by the client browser and hence you need to write JavaScript code to do the same.

No comments:

Post a Comment