Possible Duplicate:
How do I dynamically create new Hyperlinks in ASP.NET?
I am adding tables dynamically in my code. i want to add this using coding in my code behind file. My code is given below:
<table>
<tr>
<td class="what-to-expect">
<a href="#TB_inline?height=200&width=300&inlineId=myOnPageContent" title="add a caption to title attribute" class="thickbox">?</a>
</td>
</tr>
</table>
Can anyone tell me how to add this through code?
code added from comments
HtmlTableRow trContent = new HtmlTableRow();
HtmlTableCell cell1 = new HtmlTableCell();
cell1.InnerText = SomeTextHere;
trContent.Cells.Add(cell1)
Thanks in advance.
What you want to do is add a
HyperLink
control to your CellUse
<asp:literal runat="server" id="lblSomething" />
.Then in your code behind, write something like this:
Create a HyperLink object in code, assign all the relevant data to it, then add it to the relevant cell.
So something like