/// <summary> /// 加载对话框的模板 /// </summary> /// <returns></returns> protected virtual Control LoadDialogTemplate() { DialogContentAttribute contentAttr = AttributeHelper.GetCustomAttribute <DialogContentAttribute>(this.GetType()); var contentHtml = ""; if (contentAttr != null && string.IsNullOrEmpty(contentAttr.ResourcePath) == false) { Assembly assembly = Assembly.GetExecutingAssembly(); if (string.IsNullOrEmpty(contentAttr.AssemblyName) == false) { assembly = Assembly.Load(contentAttr.AssemblyName); } LoadingDialogContentEventArgs e = new LoadingDialogContentEventArgs(); OnLoadingDialogContent(this, e); contentHtml = e.Content; if (contentHtml.IsNullOrEmpty()) { contentHtml = ResourceHelper.LoadStringFromResource(assembly, contentAttr.ResourcePath); } } contentHtml = ReplaceDialogTemplateString(contentHtml); return(Page.ParseControl(contentHtml)); }
/// <summary> /// 页面渲染之前 /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { if (this.CurrentMode == ControlShowingMode.Normal) { if (this.BeforeNormalPreRender != null) { this.BeforeNormalPreRender(this, e); } } base.OnPreRender(e); if (this.CurrentMode == ControlShowingMode.Dialog) { DialogContentAttribute contentAttr = AttributeHelper.GetCustomAttribute <DialogContentAttribute>(this.GetType()); if (contentAttr != null) { this.EnableViewState = contentAttr.EnableViewState; } } }