protected override void OnInit(EventArgs e) { base.OnInit(e); string userControl = ChildControl; try { // UpdatePanel up = new UpdatePanel(); // DatePicker dp = new DatePicker(); // dp.Style["display"] = "none"; // WaitStatus wait = new WaitStatus(); // wait.ID = "wait1"; // wait.Style["position"] = "absolute"; // wait.Style["left"] = "500px"; // up.UpdateMode = UpdatePanelUpdateMode.Conditional; // Controls.Add(up); // Controls.Add(dp); // up.ContentTemplateContainer.Controls.Add(wait); // up.ContentTemplateContainer.Controls.Add(Page.LoadControl(userControl)); Controls.Add(Page.LoadControl(userControl)); } catch (Exception exception) { string message = string.Format("{0} failed to load: {1}", userControl, exception.Message); Controls.Add(new LiteralControl(message)); } UpdateProgressBar updateProgressBar = new UpdateProgressBar(); Controls.Add(updateProgressBar); }
protected override void OnInit(EventArgs e) { _updateProgressBar = new UpdateProgressBar { ID = "modalUpdateProgressBar", ModalPopupBehaviorID = "UpdateProgressBar" }; Form.Controls.Add(_updateProgressBar); logMonitor = new LogMonitorWeb(); Form.Controls.Add(logMonitor); // Form.Controls.Add(new ServiceProcedureControl()); Page.Title = ResourceName; base.OnInit(e); PreRenderComplete += Page_PreRenderComplete; }
protected override void OnInit(EventArgs e) { if (File.Exists(HttpContext.Current.Server.MapPath("WebServiceFilters.asmx"))) { ScriptManager?.Services.Add( new ServiceReference { Path = "/WebServiceFilters.asmx", }); } Trace.WriteExt("BaseMainPage.BeginOnInit"); if (PlaceHolderInUpInternal != null) { hiddenfieldForUrl = new HiddenField(); hiddenfieldForUrl.ID = "hfCUrl"; PlaceHolderInUpInternal.Controls.Add(hiddenfieldForUrl); var value = Request.Params[hiddenfieldForUrl.UniqueID]; if (!string.IsNullOrEmpty(value)) { MainPageUrlBuilder.Current = new MainPageUrlBuilder(value); } } var url = MainPageUrlBuilder.Current; if (url.IsDownload) { if (url.QueryParameters.ContainsKey("ManagerType")) { var type = BuildManager.GetType(url.QueryParameters["ManagerType"], false, true); var fileManager = (IFileManager)Activator.CreateInstance(type); if (fileManager.CheckPermit(Page)) { fileManager.DownloadFile(Convert.ToInt64(url.QueryParameters["ID"]), url.QueryParameters["fieldName"], Response); _control = Page.LoadControl("/UserControls/FileNotExists.ascx"); } else { _control = Page.LoadControl("/UserControls/NoPermit.ascx"); } PlaceHolder.Controls.Add(_control); } } if (url.IsExecute) { if (url.QueryParameters.ContainsKey("ManagerType")) { var type = BuildManager.GetType(url.QueryParameters["ManagerType"], false, true); var executeManager = (IExecuteManager)Activator.CreateInstance(type); if (executeManager.CheckPermit(Page)) { executeManager.Execute(url.QueryParameters, Page); } else { _control = Page.LoadControl("/UserControls/NoPermit.ascx"); } PlaceHolder.Controls.Add(_control); } } else if (!string.IsNullOrEmpty(url.UserControl)) { if (!EmptyPage) { _updateProgressBar = new UpdateProgressBar { ModalPopupBehaviorID = "UpdateProgressBar" }; _picturePreview = (PicturePreview)LoadControl("/Preview/PicturePreview.ascx"); Form.Controls.Add(_updateProgressBar); Form.Controls.Add(_picturePreview); } string redirectUrl = GetRedirectUrl(url.UserControl); if (!string.IsNullOrEmpty(redirectUrl)) { Response.Redirect(redirectUrl); } _control = BaseMainPage.LoadControl(Page, url.UserControl); //проверка прав, если нет прав, то загрузить контрол "Нет прав" var access = _control as IAccessControl; Trace.WriteExt("BaseMainPage.OnInit.BeginCheckPermit"); if ((access != null && !access.CheckPermit(this))) { _control = Page.LoadControl("/UserControls/NoPermit.ascx"); } Trace.WriteExt("BaseMainPage.OnInit.EndCheckPermit"); if (!UserRoles.IsInRole(UserRoles.ADMIN)) { Trace.WriteExt("BaseMainPage.OnInit.BeginEnsureRecordCardCorrect"); var userControl = EnsureRecordCardCorrect(); Trace.WriteExt("BaseMainPage.OnInit.EndEnsureRecordCardCorrect"); if (userControl != null) { _control = userControl; } } if (url.NavigateTo) { var navControl = (AbstractUserControl)_control; var projectName = navControl.ProjectName; var tableName = navControl.TableName; var baseType = navControl.GetType().BaseType; if (string.IsNullOrEmpty(projectName)) { projectName = baseType.Assembly.FullName.Split(',')[0]; } if (string.IsNullOrEmpty(tableName) && baseType.Name.EndsWith(MainPageUrlBuilder.UserControlTypeEdit)) { tableName = baseType.Name; tableName = tableName.Substring(0, tableName.Length - MainPageUrlBuilder.UserControlTypeEdit.Length); } var navigateUrl = NavigatorManager.GetReadUrlForRecord( projectName, tableName, url.QueryParameters[MainPageUrlBuilder.ReferencIDPrefix + tableName], url.QueryParameters.ContainsKey(MainPageUrlBuilder.NavigateToDestinationParentTableName) ? url.QueryParameters[MainPageUrlBuilder.NavigateToDestinationParentTableName] : string.Empty, regexPublicKeyToken.Match(baseType.Assembly.FullName).Groups[1].Value); Response.Redirect(navigateUrl); } var selected = _control as ISelectedValue; _control.ID = "item"; var placeHolder = GetMainPlaceHolder(); if (url.TimeoutInSQL) { placeHolder.Controls.Add(new Literal { Text = "<span class=\"font14\" style=\"color:red\">" + Resources.SFilterInSqlTimeOutException + "</span>", }); } if (_control is IFilterSupport fSupport && InitializerSection.AddFilterInMainPageInternal && (url.IsSelect || url.ShowFilter)) { _filterControl = LoadControlFilter(fSupport.GetDefaultFilterControl()); _filterControl.ID = "filter"; placeHolder.Controls.Add(_filterControl); placeHolder.Controls.Add(new Literal { Text = "<br /><br />" }); fSupport.FilterControl = _filterControl.ID; } if (selected != null) { selected.ShowHistory = url.ShowHistory; selected.IsNew = url.IsNew; selected.IsRead = url.IsRead; selected.IsSelect = url.IsSelect; } placeHolder.Controls.Add(_control); } else if (!string.IsNullOrEmpty(DefaultControl)) { _control = Page.LoadControl(DefaultControl); if (_control != null) { PlaceHolder.Controls.Add(_control); } } Trace.WriteExt("BaseMainPage.EndOnInit"); base.OnInit(e); PreRenderComplete += Page_PreRenderComplete; }