Exemple #1
0
 internal void NotifyDesigner()
 {
     if (WebControls.IsDesignMode() && (base.Site != null))
     {
         IDesignerHost             dh       = (IDesignerHost)base.Site.Container;
         ControlDesigner           designer = (ControlDesigner)dh.GetDesigner(this);
         PropertyDescriptor        pd       = TypeDescriptor.GetProperties(this)["Toolbar"];
         ComponentChangedEventArgs objArgs  = new ComponentChangedEventArgs(this, pd, null, this);
         designer.OnComponentChanged(this, objArgs);
     }
 }
Exemple #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// There are 2 parts to render for each tab.  The Label and the panel with the contents.
        /// The contents are rendered through the normal rendering methods, however, an explicit call
        /// is made to render the label since we may render the label but not the contents
        /// </summary>
        /// <value></value>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [Jon Henning]	8/7/2006	Commented
        /// </history>
        /// -----------------------------------------------------------------------------
        internal void RenderLabel(HtmlTextWriter writer)
        {
            bool blnHasParent = (this.ParentControl != null);

            Label oLabel = new Label();

            oLabel.Controls.Clear();
            oLabel.ID = this.ClientID + "_l";
            //m_oLabel.ApplyStyle(Me.LabelStyle)
            //Me.LabelStyle.AddAttributesToRender(writer, m_oLabel)

            string sCss;

            if (this.IsSelected)
            {
                sCss = this.Label.CssClassSelected;
                if (String.IsNullOrEmpty(sCss) && blnHasParent)
                {
                    sCss = this.ParentControl.DefaultLabel.CssClassSelected;
                }
                //if not set default to strip's selected class
            }
            else if (this.Enabled == false)
            {
                sCss = this.Label.CssClassDisabled;
            }
            else
            {
                sCss = this.Label.CssClass;
            }
            if (blnHasParent)
            {
                if (this.Enabled)
                {
                    if (String.IsNullOrEmpty(sCss))
                    {
                        sCss = this.ParentControl.CssClass;
                    }
                    //if not set default to tabs normal class
                    if (String.IsNullOrEmpty(sCss))
                    {
                        sCss = this.ParentControl.DefaultLabel.CssClass;
                    }
                    //if not set default to strip's default label class
                }
                else
                {
                    if (String.IsNullOrEmpty(sCss))
                    {
                        sCss = this.ParentControl.DefaultLabel.CssClassDisabled;
                    }
                    //if not set default to strip's default label class
                }
            }
            if (!String.IsNullOrEmpty(sCss))
            {
                oLabel.CssClass = sCss;
            }

            oLabel.Attributes.Add("tid", this.ID);
            //Me.Label.WriteAttributes(oLabel)
            if (!String.IsNullOrEmpty(this.Label.CssClass))
            {
                oLabel.Attributes.Add("css", this.Label.CssClass);
            }
            if (!String.IsNullOrEmpty(this.Label.CssClassSelected))
            {
                oLabel.Attributes.Add("csssel", this.Label.CssClassSelected);
            }
            if (!String.IsNullOrEmpty(this.Label.CssClassHover))
            {
                oLabel.Attributes.Add("csshover", this.Label.CssClassHover);
            }
            if (!String.IsNullOrEmpty(this.Label.CssClassDisabled))
            {
                oLabel.Attributes.Add("cssdisabled", this.Label.CssClassDisabled);
            }

            if (this.Enabled == false)
            {
                oLabel.Attributes.Add("enabled", "0");
            }
            if (this.Visible == false)
            {
                oLabel.Style.Add("display", "none");
            }

            if (WebControls.IsDesignMode())
            {
                //messes up design time view when locating form, so bypass in designer
                if (this.ParentControl.IsDownLevel == false)
                {
                    if (this.TabRenderMode == DNNTabStrip.eTabRenderMode.CallBack)
                    {
                        switch (this.TabCallbackPostMode)
                        {
                        case eTabCallbackPostMode.DNNVariable:
                            oLabel.Attributes.Add("postmode", DotNetNuke.UI.Utilities.ClientAPI.DNNVARIABLE_CONTROLID);
                            break;

                        case eTabCallbackPostMode.Form:
                            Control oCtl = this.ParentControl;
                            while (!(oCtl is System.Web.UI.HtmlControls.HtmlForm))
                            {
                                oCtl = oCtl.Parent;
                                if (oCtl == null)
                                {
                                    break;                                             // TODO: might not be correct. Was : Exit While
                                }
                            }

                            if ((oCtl != null))
                            {
                                oLabel.Attributes.Add("postmode", oCtl.ClientID);
                            }
                            else
                            {
                                throw new Exception("Could not find form control");
                            }

                            break;

                        case eTabCallbackPostMode.TabStrip:
                            oLabel.Attributes.Add("postmode", this.ParentControl.ClientID);
                            break;
                        }
                    }

                    if (this.CallBackType != ParentControl.CallBackType)
                    {
                        oLabel.Attributes.Add("cbtype", (this.CallBackType).ToString());
                    }
                }
                else
                {
                    if (this.ParentControl.IsDownLevel)
                    {
                        oLabel.Attributes.Add("onclick", ClientAPI.GetPostBackClientHyperlink(this.ParentControl, this.ID + ClientAPI.COLUMN_DELIMITER + "OnDemand"));
                    }
                }
            }

            if (!String.IsNullOrEmpty(this.Label.ImageUrl) || (blnHasParent && (!String.IsNullOrEmpty(this.ParentControl.DefaultLabel.ImageUrl))))
            {
                Image oImg = new Image();
                oImg.ID       = this.ClientID + "_i";
                oImg.ImageUrl = this.Label.ImageUrl;
                if (String.IsNullOrEmpty(oImg.ImageUrl))
                {
                    oImg.ImageUrl = this.ParentControl.DefaultLabel.ImageUrl;
                }
                oLabel.Controls.Add(oImg);
            }
            if (blnHasParent && !String.IsNullOrEmpty(this.ParentControl.WorkImage))
            {
                Image oImg = new Image();
                oImg.ID       = this.ClientID + "_w";
                oImg.ImageUrl = this.ParentControl.WorkImage;
                oImg.Style.Add("display", "none");
                oLabel.Controls.Add(oImg);
            }

            oLabel.Controls.Add(new LiteralControl(this.Label.Text));
            oLabel.RenderControl(writer);
        }