custom-event

Custom event in HTML, Javascript

筅森魡賤 提交于 2019-11-28 04:01:15
问题 I'm looking to create a custom event in HTML, JS. <input type="text" oncustombind="foo(event);" /> How can I create one such? 'oncustombind' is the custom event I want to create. I should be able to call the function/code defined in the oncustombind attribute. Also, I need to pass some data to the event object. I don't want to use any libraries such as jquery, YUI. Any help would be deeply appreciated. 回答1: You want a CustomEvent They should be easy to work with but browser support is poor.

How to work with delegates and event handler for user control

旧城冷巷雨未停 提交于 2019-11-27 16:33:59
问题 I have created a user control that contains a button. I am using this control on my winform which will be loaded at run time after fetching data from database. Now I need to remove a row from a datatable on the Click event of that button. The problem is that how do I capture that event in my form. Currently it goes in that user control's btn click event defination. 回答1: You can create your own delegate event by doing the following within your user control: public event UserControlClickHandler