Saturday

Controls.add c#/asp.net adding controls table/rows/labels

ASPX page must have placeholder

<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:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...