Example #1
0
        /// <summary>
        /// Allows a listener to be associated to a client side post back
        /// </summary>
        /// <param name="objParent">The current control on the page or the page itself.  Depending on where the page is in its lifecycle it may not be possible to add a control directly to the page object, therefore we will use the current control being rendered to append the postback control.</param>
        /// <param name="strEventName">Name of the event to sync.  If a page contains more than a single client side event only the events associated with the passed in name will be raised.</param>
        /// <param name="objDelegate">Server side AddressOf the function to handle the event</param>
        /// <param name="blnMultipleHandlers">Boolean flag to determine if multiple event handlers can be associated to an event.</param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [Jon Henning]	9/15/2004	Created
        /// </history>
        public static void RegisterPostBackEventHandler(Control objParent, string strEventName, ClientAPIPostBackControl.PostBackEvent objDelegate, bool blnMultipleHandlers)
        {
            const string CLIENTAPI_POSTBACKCTL_ID = "ClientAPIPostBackCtl";
            Control      objCtl = Globals.FindControlRecursive(objParent.Page, CLIENTAPI_POSTBACKCTL_ID); //DotNetNuke.Globals.FindControlRecursive(objParent, CLIENTAPI_POSTBACKCTL_ID)

            if (objCtl == null)
            {
                objCtl    = new ClientAPIPostBackControl(objParent.Page, strEventName, objDelegate);
                objCtl.ID = CLIENTAPI_POSTBACKCTL_ID;
                objParent.Controls.Add(objCtl);
                RegisterClientVariable(objParent.Page, "__dnn_postBack", GetPostBackClientHyperlink(objCtl, "[DATA]"), true);
            }
            else if (blnMultipleHandlers)
            {
                ((ClientAPIPostBackControl)objCtl).AddEventHandler(strEventName, objDelegate);
            }
        }
Example #2
0
 /// <summary>
 /// Allows a listener to be associated to a client side post back
 /// </summary>
 /// <param name="objParent">The current control on the page or the page itself.  Depending on where the page is in its lifecycle it may not be possible to add a control directly to the page object, therefore we will use the current control being rendered to append the postback control.</param>
 /// <param name="strEventName">Name of the event to sync.  If a page contains more than a single client side event only the events associated with the passed in name will be raised.</param>
 /// <param name="objDelegate">Server side AddressOf the function to handle the event</param>
 /// <param name="blnMultipleHandlers">Boolean flag to determine if multiple event handlers can be associated to an event.</param>
 /// <remarks>
 /// </remarks>
 /// <history>
 /// 	[Jon Henning]	9/15/2004	Created
 /// </history>
 public static void RegisterPostBackEventHandler(Control objParent, string strEventName, ClientAPIPostBackControl.PostBackEvent objDelegate, bool blnMultipleHandlers)
 {
     const string CLIENTAPI_POSTBACKCTL_ID = "ClientAPIPostBackCtl";
     Control objCtl = Globals.FindControlRecursive(objParent.Page, CLIENTAPI_POSTBACKCTL_ID); //DotNetNuke.Globals.FindControlRecursive(objParent, CLIENTAPI_POSTBACKCTL_ID)
     if (objCtl == null)
     {
         objCtl = new ClientAPIPostBackControl(objParent.Page, strEventName, objDelegate);
         objCtl.ID = CLIENTAPI_POSTBACKCTL_ID;
         objParent.Controls.Add(objCtl);
         RegisterClientVariable(objParent.Page, "__dnn_postBack", GetPostBackClientHyperlink(objCtl, "[DATA]"), true);
     }
     else if (blnMultipleHandlers)
     {
         ((ClientAPIPostBackControl)objCtl).AddEventHandler(strEventName, objDelegate);
     }
 }