如何在代码隐藏中添加或插入div中的标签? [英] how to add or insert tag inside div from codebehind ?
本文介绍了如何在代码隐藏中添加或插入div中的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从代码隐藏中复制div中的标签,我该怎么办?
I want to duplicate tag inside div from the codebehind how can I do?
推荐答案
System.Web.UI.HtmlControls.HtmlGenericControl createDiv =
new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
createDiv.ID = "createDiv";
createDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Yellow");
createDiv.Style.Add(HtmlTextWriterStyle.Color, "Red");
createDiv.InnerHtml = "Div added from code behind ";
this.Controls.Add(createDiv);
<div>
<img alt="httpHandler" src="getImage.ashx?id=1">
<img alt="httpHandler" src="getImage.ashx?id=2">
<img alt="httpHandler" src="getImage.ashx?id=3">
<img alt="httpHandler" src="getImage.ashx?id=4">
</div>
<div class="hover-box" id="Etkinlik" runat="server">
<a class="zoom" href='<%# "../EtkinlikResimGetir.ashx?ImID=" + Eval("id")%>'></a>
</div>
这里只有一个 标签所以只有一张来自httphandler的图片我想复制一个标签来发送http处理程序
here only one tag so only one images coming from httphandler I wanto to duplicate a tag to send http handler
这篇关于如何在代码隐藏中添加或插入div中的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文