We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How can I catch ''KeyPress'' event on a page without any elements?

Thread ID:





95624 Jul 21,2010 05:38 PM Jul 23,2010 10:28 AM Windows Forms 4
Tags: HTMLUIControl
Dmitry Sergey
Asked On July 21, 2010 05:38 PM

I have loaded html-file as following:



How can I catch 'KeyPress' event for such kind of loaded HTML to initiate any actions on it?

Thanks in advance.

Dmitry Sergey
Replied On July 21, 2010 05:49 PM

I have tried to use code:

private void htmluiControl1_LoadFinished(object sender, EventArgs e)
IHTMLElement[] elem = this.htmluiControl1.Document.GetElementsByName("body");
elem[0].KeyPress += new EventHandler(this.ElementKeyPress);

But it doesn't work...

Lokanath E [Syncfusion]
Replied On July 22, 2010 09:43 AM

Hi Dmitry,

Thanks for using Syncfusion products.

KeyPress event will be fired only for supporting elements. Refer the documentation from following link to get more details about this.

Refer the sample from the following link which demonstrates the above,


Please let me know if you have any queries.


Dmitry Sergey
Replied On July 22, 2010 10:37 AM

Earlier I could use JavaScript to process pressing some key:


But now I cannot :( It's too sorry...

Thank you anyway for your help.

Lokanath E [Syncfusion]
Replied On July 23, 2010 10:28 AM

Hi Dmitry,

Thanks for your update.

We have attached a sample to demonstrate how scripts can be used with HTMLUI at the following link


Please let us know if you need further assistance.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.