<asp:PlaceHolder ID="DynamicPlaceHolder" runat="server"></asp:PlaceHolder>
codebehind
protected override void OnPreRender(EventArgs e)
{
HtmlTable mainHtmlTable = new HtmlTable();
HtmlTableRow helpTableRow = AddLabelRow(mainHtmlTableRow.Cells.Count, "Hello World",true);
mainHtmlTable.Rows.Add(helpTableRow);
DynamicPlaceHolder.Controls.Add(mainHtmlTable);
}
public HtmlTableRow AddLabelRow(int cellCount, string text,bool applySkin)
{
HtmlTableRow helpTableRow = new HtmlTableRow();
HtmlTableCell helpTableCell = new HtmlTableCell();
//helpTableCell.Attributes.Add("style", "border: solid 2px; border-color: Blue;");
helpTableCell.ColSpan = cellCount;
Label helpLabel = new Label();
if (applySkin) helpLabel.SkinID = "labelBoldSkin";
helpLabel.Text = "<br>"+text;
helpTableCell.Controls.Add(helpLabel);
helpTableRow.Cells.Add(helpTableCell);
return helpTableRow;
}
more...
No comments:
Post a Comment