-
Notifications
You must be signed in to change notification settings - Fork 0
4. MasterPage
franciscoserdio edited this page Sep 20, 2016
·
11 revisions
The MasterPage does the following:
-
Includes the component
<%@ Register Src="~/Controls/MessageBox.ascx" TagName="ucMessageBox" TagPrefix="ctrls" %> <asp:UpdatePanel ID="upMessages" runat="server" UpdateMode="Conditional"> <contenttemplate> <ctrls:ucMessageBox ID="ctlMessageBox" runat="server" Visible="false" OnResponse="ctlMessageBox_OnResponse" /> </contenttemplate> </asp:UpdatePanel> -
Declares the same events to forward them
/// <summary> /// The message box OnResponse CommandEventHandler /// </summary> public delegate MessageBoxEventHandler OnResponseMessageBox(object sender, MessageBoxEventArgs e);
/// <summary> /// The message box response event /// </summary> public event MessageBoxEventHandler ResponseMessageBox;
-
Handles the component events and forward them to pages (System.Web.UI.Page), see 5 in this wiki
/// <summary> /// Handles the OnResponse event of the ctlMessageBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MessageBoxEventArgs"/> instance containing the event data.</param> protected void ctlMessageBox_OnResponse(object sender, MessageBoxEventArgs e) { if (null != this.ResponseMessageBox) { this.ResponseMessageBox( sender, e); } else { // Loosing the user response } }