custom-event

Create custom wpf event

六眼飞鱼酱① 提交于 2019-12-03 06:01:23
i've created an UserControl for Database connection where user input Username and Password for a connection. This UserControl is in a MainWindow.xaml Now, in code behind of my UserControl i create a MSSQL connection. If login Successfully, i want to Raise a custom event to expose in MainWindow. For example in MyUserControl.xaml.cs try { using (SqlConnection sqlConn = new SqlConnection(connection)) { sqlConn.Open(); MessageBox.Show("Connessione Riuscita!", "Connessione a " + TextIP.Text, MessageBoxButton.OK, MessageBoxImage.Information); RaiseMyEvent(); sqlConn.Close(); } } catch (SqlException

Object doesn't support this action IE9 with CustomEvent Initialization

痴心易碎 提交于 2019-12-03 01:59:15
I am getting the following error in IE9: "Object doesn't support this action". There are various question about this, but mine is specifically for the following code: var myEvent = new CustomEvent("additem"); From my understanding, CustomEvent is supported in IE9 as a DOM manipulation command. This works fine in Chrome without any exception. Anyone has this problem and know how to solve it? Thanks. Afaik custom events are not supported in IE, only in normal browsers. I suggest using a javascript library that provides a browser independent implementation like Jquery's trigger: http://api.jquery

event.preventDefault() is not working in IE 11 for custom events

烂漫一生 提交于 2019-12-02 02:38:56
I have a polymer element which triggers a custom event synchronously and I want to know whether the event was cancelled using event.preventDefault(). Using event.defaultPrevented I can know the intended action. This works on all browsers(Chrome, Canary, Firefox, Opera) but on IE 11 (not worried about older browsers) its not working. I know I can set some property on my event and check for that back where I am triggering and handle but want to know if there is something else which I missed. You can try out the code from http://jsbin.com/husamupi/1/edit I had the same problem and could solve it

event.preventDefault() is not working in IE 11 for custom events

烂漫一生 提交于 2019-12-02 01:55:25
问题 I have a polymer element which triggers a custom event synchronously and I want to know whether the event was cancelled using event.preventDefault(). Using event.defaultPrevented I can know the intended action. This works on all browsers(Chrome, Canary, Firefox, Opera) but on IE 11 (not worried about older browsers) its not working. I know I can set some property on my event and check for that back where I am triggering and handle but want to know if there is something else which I missed.

define Custom Event for WebControl in asp.net

孤街浪徒 提交于 2019-12-01 04:01:06
I need to define 3 events in a Custom Control as OnChange , OnSave , and OnDelete . I have a GridView and work with its rows. Can you help me and show me this code? Pranay Rana Good article which can help you to achieve your task: Custom Controls in Visual C# .NET Step 1: Create the event handler in your control as below. public event SubmitClickedHandler SubmitClicked; // Add a protected method called OnSubmitClicked(). // You may use this in child classes instead of adding // event handlers. protected virtual void OnSubmitClicked() { // If an event has no subscribers registered, it will //

How do I detect a transition end without a JavaScript library?

≡放荡痞女 提交于 2019-12-01 03:38:35
I'd like to delete an object after it's done animating with a CSS transition, but I'm not able to use a JavaScript library. How do I detect when the animation is done? Do I use a callback or custom event somehow? element.addEventListener('transitionend', function(event) { alert("CSS Property completed: " + event.propertyName); }, false ); For now, the exact event name has not been standardized. Here's a quote from MDN : There is a single event that is fired when transitions complete. In all standard-compliant browser, the event is transitionend , in WebKit it is webkitTransitionEnd . Here's

define Custom Event for WebControl in asp.net

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 01:31:22
问题 I need to define 3 events in a Custom Control as OnChange , OnSave , and OnDelete . I have a GridView and work with its rows. Can you help me and show me this code? 回答1: Good article which can help you to achieve your task: Custom Controls in Visual C# .NET Step 1: Create the event handler in your control as below. public event SubmitClickedHandler SubmitClicked; // Add a protected method called OnSubmitClicked(). // You may use this in child classes instead of adding // event handlers.

ASP.NET TextBox LostFocus event

妖精的绣舞 提交于 2019-11-30 05:24:09
问题 I need to trigger code on the server side to be called when a TextBox loses focus. I know there is the onblur client side event, and that there is no LostFocus event, so how can I cause a postback to occur when my TextBox loses focus? Update: I have found a blog which seems to give a pretty decent solution to this. It involves adding a custom event to a TextBox subclass, and registering a client script which calls the server-side event in the onblur JavaScript client event. The following is

Custom event in HTML, Javascript

只愿长相守 提交于 2019-11-29 10:26:23
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. You want a CustomEvent They should be easy to work with but browser support is poor. However the DOM-shim should fix that. var ev = new CustomEvent("someString"); var el = document

How to work with delegates and event handler for user control

我只是一个虾纸丫 提交于 2019-11-29 02:11:22
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. You can create your own delegate event by doing the following within your user control: public event UserControlClickHandler InnerButtonClick; public delegate void UserControlClickHandler (object sender, EventArgs e); You call the