zoukankan      html  css  js  c++  java
  • updatepanel in webpart

    protected override void CreateChildControls()
    {
    base.CreateChildControls();
    LinkButton goButton;
    goButton
    = new LinkButton();
    goButton.ID
    = "butGo";
    goButton.Text
    = "Go";
    goButton.Command
    += new CommandEventHandler(goButton_Command);
    goButton.Click
    += new EventHandler(goButton_Click);
    goButton.CausesValidation
    = false;
    Controls.Add(goButton);
    UpdatePanel updatePanel;
    updatePanel
    = new UpdatePanel();

    updatePanel.ID
    = "upUpdatePanel";
    updatePanel.UpdateMode
    = UpdatePanelUpdateMode.Conditional;
    updatePanel.ChildrenAsTriggers
    = false;
    AsyncPostBackTrigger t
    = new AsyncPostBackTrigger();
    t.EventName
    = "Command";
    t.ControlID
    = goButton.ID;
    updatePanel.Triggers.Add(t);
    Label lb
    = new Label();
    lb.ID
    = "DT";
    lb.Text
    = "Time";
    updatePanel.ContentTemplateContainer.Controls.Add(lb);
    Controls.Add(updatePanel);

    }
    private void goButton_Command(object sender, CommandEventArgs e)
    {
    Control ctl
    = sender as Control;
    UpdatePanel up
    = ctl.NamingContainer.FindControl("upUpdatePanel") as UpdatePanel;
    Label lbl
    = up.ContentTemplateContainer.FindControl("DT") as Label;
    lbl.Text
    = DateTime.Now.ToString();

    }

  • 相关阅读:
    android Animation整理
    js的console总结
    [原创]cocos2d-lua学习笔记(0)-提纲
    【转】js怎么编译成JSC
    【转】PCDuino用python读取GPIO数据
    Mysql数据库大小相关的问题
    oracle with as
    python jar
    investopedia level 2
    warning MSB3391
  • 原文地址:https://www.cnblogs.com/icedog/p/1824072.html
Copyright © 2011-2022 走看看