System.Web.UI.WebControls.WebControl.ApplyStyle C# (CSharp) Method

ApplyStyle() public method

public ApplyStyle ( System.Web.UI.WebControls.Style s ) : void
s System.Web.UI.WebControls.Style
return void
		public void ApplyStyle (Style s) 
		{
			if (s != null && !s.IsEmpty)
				ControlStyle.CopyFrom(s);
		}

Usage Example

Example #1
0
        void RenderBeginTag(HtmlTextWriter w, Style s, WebControl wc)
        {
            WebControl c;

            switch (RepeatLayout)
            {
            case RepeatLayout.Table:
                c = new Table();
                break;

            case RepeatLayout.Flow:
                c = new Label();
                break;

            case RepeatLayout.OrderedList:
                c = new WebControl(HtmlTextWriterTag.Ol);
                break;

            case RepeatLayout.UnorderedList:
                c = new WebControl(HtmlTextWriterTag.Ul);
                break;

            default:
                throw new InvalidOperationException(String.Format("Unsupported RepeatLayout value '{0}'.", RepeatLayout));
            }

            c.ID = wc.ClientID;
            c.CopyBaseAttributes(wc);
            c.ApplyStyle(s);
            c.Enabled = wc.IsEnabled;
            c.RenderBeginTag(w);
        }
All Usage Examples Of System.Web.UI.WebControls.WebControl::ApplyStyle