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

I have loaded html-file as following:


Template













Text






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

Thanks in advance.

4 Replies

DS Dmitry Sergey July 21, 2010 09:49 PM UTC

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...


LE Lokanath E Syncfusion Team July 22, 2010 01:43 PM UTC

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.

http://172.168.111.149/UG_82/WindowsFormsUI_HTMLUI/ElementEvents.html

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

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=keypress-211204258.zip

Please let me know if you have any queries.

Regards,
Lokanath.E


DS Dmitry Sergey July 22, 2010 02:37 PM UTC

Earlier I could use JavaScript to process pressing some key:
...

...

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

Thank you anyway for your help.


LE Lokanath E Syncfusion Team July 23, 2010 02:28 PM UTC

Hi Dmitry,

Thanks for your update.

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

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=keypress-768003212.zip

Please let us know if you need further assistance.

Regards,
Lokanath.E

Loader.
Up arrow icon