Table.AddAttributesToRender Method

Adds HTML attributes and styles that need to be rendered to the specified HtmlTextWriter.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

protected:
virtual void AddAttributesToRender (
	HtmlTextWriter^ writer
) override
protected void AddAttributesToRender (
	HtmlTextWriter writer
)
protected override function AddAttributesToRender (
	writer : HtmlTextWriter
)

Parameters

writer

The output stream that renders HTML content to the client.

This method is used primarily by control developers to insert the appropriate attributes and styles into the HtmlTextWriter output stream for a Table control. This method overrides WebControl.AddAttributesToRender.

The following code example demonstrates how to override the AddAttributesToRender method in a custom server control to add an attribute to the Table.

No code example is currently available or this language may not be supported.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
	<HEAD>
		<title>Custom Table - AddAttributesToRender - VJ# Example</title>
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<h3>Custom Table - AddAttributesToRender - VJ# Example</h3>

			<aspSample:CustomTableAddAttributesToRender 
			  id="Table1" 
			  runat="server" 
			  GridLines="Both" 
			  CellPadding="4">
        <asp:TableRow>
          <asp:TableCell>Row 0, Col 0</asp:TableCell>
          <asp:TableCell>Row 0, Col 1</asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
          <asp:TableCell>Row 1, Col 0</asp:TableCell>
          <asp:TableCell>Row 1, Col 1</asp:TableCell>
        </asp:TableRow>
      </aspSample:CustomTableAddAttributesToRender>
      
		</form>
	</body>
</HTML>
...package Samples.AspNet.JSL.Controls; 

public class CustomTableAddAttributesToRender
    extends System.Web.UI.WebControls.Table
{
    protected void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
    {
        // Add a client-side onclick event to the button.
        writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Onclick, 
            "alert('Hello World');");
        // Call the base's AddAttributesToRender method.
        super.AddAttributesToRender(writer);
    } //AddAttributesToRender
} //CustomTableAddAttributesToRender

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: