TableCell.RenderContents Method
Assembly: System.Web (in system.web.dll)
If the TableCell control has child controls or is overridden in a derived class the base class's RenderContents method is called; otherwise, the value of the Text property is written to the HtmlTextWriter object.
The RenderContents method is used primarily by control developers extending the functionality of the TableCell control.
The following code example demonstrates how to override the RenderContents method in a custom TableCell control so that it custom text is inserted in the cell's contents.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<html>
<head>
<title>Custom TableCell - RenderContents - VJ# Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom TableCell - RenderContents - VJ# Example</h3>
<asp:Table
id="Table1"
runat="server"
CellPadding="3"
CellSpacing="2">
<asp:TableRow>
<aspSample:CustomTableCellRenderContents Text="(0,0)" />
<aspSample:CustomTableCellRenderContents Text="(0,1)" />
<aspSample:CustomTableCellRenderContents Text="(0,2)" />
</asp:TableRow>
<asp:TableRow>
<aspSample:CustomTableCellRenderContents Text="(1,0)" />
<aspSample:CustomTableCellRenderContents Text="(1,1)" />
<aspSample:CustomTableCellRenderContents Text="(1,2)" />
</asp:TableRow>
</asp:Table>
</form>
</body>
</html>
package Samples.AspNet.JSL.Controls;
public class CustomTableCellRenderContents
extends System.Web.UI.WebControls.TableCell
{
protected void RenderContents(System.Web.UI.HtmlTextWriter writer)
{
// Insert text into each TableCell.
writer.Write("TableCell: ");
// Call the base RenderContents method.
super.RenderContents(writer);
}
}
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.