[转]动态添加css文件,js文件,控件
时间:2011-02-20 来源:zjyuan
二、动态添加JS文件(通过jquery实现)
$.getScript("test.js");
三、动态添加控件(由于动态添加的控件在页面回发时会消失,所以建议在OnPreLoad重新加载)
<asp:Panel ID="pnlAddressContainer" runat="server"></asp:Panel>
protected void AddAdress(string id)
{
Label lb = new Label();
lb.Text = "Address" + id + ": ";
TextBox tb = new TextBox();
tb.ID = "TextBox" + id;
tb.Text = Request.Form[tb.ID];
Button btn = new Button();
btn.Text = "Check";
btn.ID = "Button" + id;
btn.Click += new EventHandler(ClickEvent);
pnlAddressContainer.Controls.Add(lb);
pnlAddressContainer.Controls.Add(tb);
pnlAddressContainer.Controls.Add(btn);
}
转自:http://www.cnblogs.com/gossip/archive/2011/02/20/1959154.html