AttributeCollection::AddAttributes Method
Adds attributes from the AttributeCollection class to the HtmlTextWriter object that is responsible for rendering the attributes as markup.
Assembly: System.Web (in System.Web.dll)
Parameters
- writer
- Type: System.Web.UI::HtmlTextWriter
An HtmlTextWriter instance that writes the attribute to the opening tag of an ASP.NET server control.
This method copies all the server control's attributes to an HtmlTextWriter object so that they can be rendered by the next call to the RenderBeginTag method.
For controls that are contained in other controls such as Calendar and CheckBoxList, you can potentially improve performance by rendering the contained controls directly. Rendering directly can be faster than rendering through the container control because container controls require that you copy all the child control attributes to the container control and render them after they are copied.
The following example shows how to add new attributes to a Button server control named myButton and a TextBox server control named myTextBox. It then adds those attributes to a custom HtmlTextWriter object that will write those attributes to an output stream for each of those controls.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.