【发布时间】:2016-07-14 00:41:06
【问题描述】:
我在代码隐藏中向我的页面添加父 asp.net 标签,如下所示:
Label lbl = new Label();
lbl.ID = "lblPrimary";
lbl.Text = "Testing";
placeholder.Controls.Add(lbl);
我需要最终输出看起来好像我在 aspx 中执行了以下操作:
<asp:Label ID="lblPrimary" runat="server" Text="Testing">
<asp:Label runat="server" SkinID="Required"></asp:Label>
</asp:Label>
如何从上面的代码隐藏中添加所需的标签?
【问题讨论】:
标签: c# asp.net webforms asp.net-controls