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);

 

posted on 2012-04-22 13:26  gzh4455  阅读(490)  评论(0编辑  收藏  举报