TableCell.CreateControlStyle Method
Assembly: System.Web (in system.web.dll)
The TableItemStyle created by the CreateControlStyle method is used with the Wrap, HorizontalAlign, and VerticalAlign properties.
The CreateControlStyle method is used primarily by control developers extending the functionality of the TableCell control.
The following code example demonstrates how to override the CreateControlStyle method in a custom server control so that it always returns a new instance of the TableStyle class for the TableCell.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
<HEAD>
<title>Custom TableCell - CreateControlStyle - VJ# Example</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom TableCell - CreateControlStyle - VJ# Example</h3>
<asp:Table id="Table1"
runat="server"
CellPadding="3"
CellSpacing="2">
<asp:TableRow>
<aspSample:CustomTableCellCreateControlStyle Text="(0,0)" />
<aspSample:CustomTableCellCreateControlStyle Text="(0,1)" />
<aspSample:CustomTableCellCreateControlStyle Text="(0,2)" />
</asp:TableRow>
<asp:TableRow>
<aspSample:CustomTableCellCreateControlStyle Text="(1,0)" />
<aspSample:CustomTableCellCreateControlStyle Text="(1,1)" />
<aspSample:CustomTableCellCreateControlStyle Text="(1,2)" />
</asp:TableRow>
</asp:Table>
</form>
</body>
</HTML>
package Samples.AspNet.JSL.Controls;
public class CustomTableCellCreateControlStyle
extends System.Web.UI.WebControls.TableCell
{
protected System.Web.UI.WebControls.Style CreateControlStyle()
{
// Initializes and return a new instance of the TableStyle class.
return new System.Web.UI.WebControls.TableStyle(this.get_ViewState());
} //CreateControlStyle
} //CustomTableCellCreateControlStyle
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.