Click here to Skip to main content
15,919,028 members

Comments by cyclopic (Top 3 by date)

cyclopic 9-May-12 8:58am View    
public bool GenerateLabel(SqlDataReader pSqlReader)
{
int IndexOfLabel = 1;
HtmlTableRow tmpTr = new HtmlTableRow();
HtmlTableCell tmpTd = new HtmlTableCell();
while (pSqlReader.Read()) {
Label TmpLabel = new Label();
// you may not use id if you just display the labels
TmpLabel.ID = "Label_" + IndexOfLabel.ToString();
TmpLabel.Text = pSqlReader.Item("FieldName").ToString;

tmpTd.Controls.Add(TmpLabel);
tmpTr.Controls.Add(tmpTd);
theTable.Controls.Add(tmpTr);
IndexOfLabel += 1;
}
}
cyclopic 9-May-12 8:51am View    
The function add label in td dynamicaly created but if you want to add in "static" td then :
<table>
<tr>
<td runat="server" id="td01"></td>
</tr>
</table>

and in codebehind..;
Dim TmpLabel As New Label
TmpLabel.Text = "Vive la France"
td01.Controls.Add(TmpLabel)

Bye
cyclopic 9-May-12 8:46am View    
look at solution 4

Cyclopic