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

CopyBaseAttributes() public method

public CopyBaseAttributes ( WebControl controlSrc ) : void
controlSrc WebControl
return void
		public void CopyBaseAttributes (WebControl controlSrc) 
		{
			object o;

			if (controlSrc == null) 
				return;

			Enabled = controlSrc.Enabled;

			o = controlSrc.ViewState ["AccessKey"];
			if (o != null)
				ViewState ["AccessKey"] = o;

			o = controlSrc.ViewState ["TabIndex"];
			if (o != null)
				ViewState ["TabIndex"] = o;

			o = controlSrc.ViewState ["ToolTip"];
			if (o != null)
				ViewState ["ToolTip"] = o;

			if (controlSrc.attributes != null) {
				AttributeCollection attributes = Attributes;
				
				foreach (string s in controlSrc.attributes.Keys)
					attributes [s] = controlSrc.attributes [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::CopyBaseAttributes