如何插入< a href>在文件后面的代码中的asp.net中的表中标记? [英] How to insert <a href> tag in the table in asp.net in code behind file?
本文介绍了如何插入< a href>在文件后面的代码中的asp.net中的表中标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
如何在ASP.NET中动态创建新的超链接?
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?
从注释中添加的代码
HtmlTableRow trContent = new HtmlTableRow();
HtmlTableCell cell1 = new HtmlTableCell();
cell1.InnerText = SomeTextHere;
trContent.Cells.Add(cell1)
谢谢.
推荐答案
您想要做的是将HyperLink
控件添加到单元格中
What you want to do is add a HyperLink
control to your Cell
HtmlTableRow trContent = new HtmlTableRow();
HtmlTableCell cell1 = new HtmlTableCell();
HyperLink hl = new HyperLink()
{
Text = "?",
NavigateUrl = "#TB_inline?height=200&width=300&inlineId=myOnPageContent",
CssClass="thickbox",
ToolTip = "add a caption to title attribute"
};
cell1.Controls.Add(hl);
trContent.Cells.Add(cell1)
这篇关于如何插入< a href>在文件后面的代码中的asp.net中的表中标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文