UpdatePanel 动态添加控件

UpdatePanel 动态添加控件例子,在之前面页要加一个ScriptManager

 

UpdatePanel up = new UpdatePanel();

        up.ID = "UpdatePanel1";

        this.Form.Controls.Add(up);



        LiteralControl lc = new LiteralControl(DateTime.Now.ToString());

        up.ContentTemplateContainer.Controls.Add(lc);



        Button btn = new Button();

        btn.Text = "Refresh";

        up.ContentTemplateContainer.Controls.Add(btn);

 

你可能感兴趣的:(update)