Пример #1
0
        /// <summary>
        /// Loads the child controls.
        /// </summary>
        private void LoadChildControls()
        {
            AdminView view = ManagementContext.Current.FindView(AppId, ViewId);

            if (view != null)
            {
                try
                {
                    string controlUrl = String.Format("~/Apps/{0}", view.ControlUrl);
                    if (File.Exists(Server.MapPath(controlUrl)))
                    {
                        Control ctrl = this.LoadControl(controlUrl);
                        phMain.Controls.Add(ctrl);
                        HeaderText.Text = view.GetLocalizedName();
                    }
                    else
                    {
                        DisplayError(String.Format("File {0} does no exist.", Server.MapPath(controlUrl)));
                    }
                }
                catch (Exception ex)
                {
                    DisplayError(String.Format("Error: {0}\r\n StackTrace: {1}", ex.Message, ex.StackTrace));
                }
            }
            else
            {
                DisplayError(String.Format("View \"{0}\" in application \"{1}\" not found.", ViewId, AppId));
            }
        }