Dzwebs.Net

撰写电脑技术杂文十余年

UpdatePanel构造函数使用范例

Admin | 2014-9-19 5:49:01 | 被阅次数 | 2562

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

  以上代码为CS代码,是c#版的。

  protected void Page_Load(object sender, EventArgs e)
  {
        UpdatePanel up1 = new UpdatePanel();
        up1.ID = "UpdatePanel1";
        up1.UpdateMode = UpdatePanelUpdateMode.Conditional;
        Button button1 = new Button();
        button1.ID = "Button1";
        button1.Text = "Submit";
        button1.Click += new EventHandler(Button_Click);
        Label label1 = new Label();
        label1.ID = "Label1";
        label1.Text = "A full page postback occurred.";
        up1.ContentTemplateContainer.Controls.Add(button1);
        up1.ContentTemplateContainer.Controls.Add(label1);
        Page.Form.Controls.Add(up1);
    }
    protected void Button_Click(object sender, EventArgs e)
    {
        ((Label)Page.FindControl("Label1")).Text = "Panel refreshed at " +
            DateTime.Now.ToString();
  }

  下面的代码为客户端HTML代码:

  <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
        </div>


网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231