Carrotware.CMS.UI.Base.PageProcessingHelper.InsertSpecialCtrl C# (CSharp) Method

InsertSpecialCtrl() protected method

protected InsertSpecialCtrl ( Control control, ControlLocation CtrlKey ) : void
control System.Web.UI.Control
CtrlKey ControlLocation
return void
        protected void InsertSpecialCtrl(Control control, ControlLocation CtrlKey)
        {
            string sControlPath = String.Empty;
            CarrotCakeConfig config = CarrotCakeConfig.GetConfig();

            switch (CtrlKey) {
                case ControlLocation.Header:
                    sControlPath = config.PublicSiteControls.ControlPathHeader;
                    break;

                case ControlLocation.Footer:
                    sControlPath = config.PublicSiteControls.ControlPathFooter;
                    break;
            }

            if (!String.IsNullOrEmpty(sControlPath)) {
                if (File.Exists(HttpContext.Current.Server.MapPath(sControlPath))) {
                    Control ctrl = new Control();
                    ctrl = CurrentWebPage.LoadControl(sControlPath);
                    control.Controls.Add(ctrl);
                }
            }
        }