2

净 c#。我正在使用占位符,并将跨度动态添加到占位符。如何在 c#asp.net 中添加文本以动态跨越?

4

2 回答 2

5

你可以使用 html 通用控件,它会是这样的

var yourspan = new HtmlGenericControl("span");
span.InnerHtml = "the text inside your span ";
yourspan.Attributes["id"] = "yourspan";
pannel.Controls.Add(span);

http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlgenericcontrol.aspx

于 2012-08-09T05:45:35.650 回答
2

使表运行=“服务器”

 <table id="myTable" runat="server" width="100%">    
    <tr>
    <td>
    <span></span>
    </td>
    </tr>

    </table>

    **In code behind u do like this** 
 myTable.Rows[1].Cells[0].InnerHtml = "<span id="1">" + YOURTEXT+ "</span>";
于 2012-08-09T05:56:59.443 回答