TableCell.CreateControlStyle Method
.NET Framework 3.0
Creates a TableItemStyle for the TableCell control.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
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.
<%@ Page Language="VJ#" %>
<%@ Register TagPrefix="aspSample"
Namespace="Samples.AspNet.JSL.Controls"
Assembly="Samples.AspNet.JSL" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head2" runat="server">
<title>Custom TableCell - CreateControlStyle - VJ# Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<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>
</div>
</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
Community Additions
ADD
Show: