private static void AddEventHandlerSafe(ASPxWebControl control, string eventName, string handler) {
     string existingHandler = control.GetClientSideEventHandler(eventName);
     if(string.IsNullOrEmpty(existingHandler)) {
         control.SetClientSideEventHandler(eventName, string.Format(ClientSideEventHandlerFunctionFormat, handler));
     }
     else {
         existingHandler = String.Format("{0}{1}\r\n}}", existingHandler.Substring(0, existingHandler.LastIndexOf('}')), handler);
         control.SetClientSideEventHandler(eventName, existingHandler);
     }
 }
 //Configure the client side event handlers for the control based on the scripts defined in the E2106.js file.
 private void ApplyFocusedStyleCore(ASPxWebControl dxControl)
 {
     if (dxControl != null)
     {
         dxControl.SetClientSideEventHandler("GotFocus",
                                             string.Format("function(s,e){{e.highlightParent = {0};e.backColor = '{1}';E2106.HighlightFocusedLayoutItem.onGotFocus(s,e);}}",
                                                           HighlightParent.ToString().ToLower(), BackColor));
         dxControl.SetClientSideEventHandler("LostFocus",
                                             string.Format("function(s,e){{e.highlightParent = {0};E2106.HighlightFocusedLayoutItem.onLostFocus(s,e);}}",
                                                           HighlightParent.ToString().ToLower()));
     }
 }
Esempio n. 3
0
        private static void AddEventHandlerSafe(ASPxWebControl control, string eventName, string handler)
        {
            string existingHandler = control.GetClientSideEventHandler(eventName);

            if (string.IsNullOrEmpty(existingHandler))
            {
                control.SetClientSideEventHandler(eventName, string.Format(ClientSideEventHandlerFunctionFormat, handler));
            }
            else
            {
                existingHandler = String.Format("{0}{1}\r\n}}", existingHandler.Substring(0, existingHandler.LastIndexOf('}')), handler);
                control.SetClientSideEventHandler(eventName, existingHandler);
            }
        }