protected static HtmlTableCell ComposeCell(TableItemStyle cellstyle, int width, params Control[] controls)
{
HtmlTableCell cell = null;
// Some controls are already HtmlTableCell, in which case they should not be encapsulated.
if (controls.Length == 1)
{
cell = controls[0] as HtmlTableCell;
}
// If the above is not the case, initialise the HtmlTableCell and add the controls.
if (cell == null)
{
cell = new HtmlTableCell();
foreach (Control control in controls)
{
cell.Controls.Add(control);
}
}
if (cellstyle != null)
cell.Attributes["class"] = cellstyle.CssClass;
cell.Width = width + "%";
return cell;
}