zoukankan      html  css  js  c++  java
  • UserControl中调用Page中的函数 EventHandler [原]

    Default.aspx:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    namespace UserControlCallPageMethod
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                this.Bind_Event();
            }
          
            private void SelectedStatusChanged(object sender, EventArgs e)
            {
                DropDownList drp = (DropDownList)sender;
                if (drp.SelectedIndex >= 0)
                {
                    this.TextBox1.Text = drp.SelectedValue;
                }
            }

            public void Bind_Event()
            {
                this.WebUserControl1_1.OnStatusChanged += SelectedStatusChanged;
            }
        }
    }
    //===========================================================================================
    WebUserControl1.ascx:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    namespace UserControlCallPageMethod
    {
        public partial class WebUserControl1 : System.Web.UI.UserControl
        {
            public EventHandler OnStatusChanged;

            protected void Page_Load(object sender, EventArgs e)
            {

            }

            protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (OnStatusChanged != null)
                {
                    OnStatusChanged(sender, e);
                }
            }
        }
    }

  • 相关阅读:
    Bluetooth GATT介绍
    Bluetooth ATT介绍
    Bluetooth GAP介绍
    Bluetooth Low Energy介绍
    CC2540介绍
    DBus介绍
    802.11 MAC层
    802.11介绍
    Python资料
    Bluedroid之GKI
  • 原文地址:https://www.cnblogs.com/RobotTech/p/903233.html
Copyright © 2011-2022 走看看