导航

.子控件与父页面

Posted on 2009-08-24 13:45  pcajax  阅读(179)  评论(0编辑  收藏  举报

 

.子控件与父页面
控件页
 public class HistoryReplyEventArgs : EventArgs
    {
        NameValueCollection _ConditionCollection;
        public NameValueCollection ConditionCollection
        {
            get { return this._ConditionCollection; }
        }
        public HistoryReplyEventArgs(NameValueCollection conditionCollection)
        {
            this._ConditionCollection = conditionCollection;
        }
    }
    public partial class Task_Reply : System.Web.UI.UserControl
    {
        public delegate void ListHistoryReplyHandler(object sender, HistoryReplyEventArgs e);
        public event ListHistoryReplyHandler ListHistoryReplyEvent;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                GameBind();
            }
        }

  protected void Button4_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TxtPhone.Text))
            {
                if (this.ListHistoryReplyEvent != null)
                {
                    NameValueCollection conditionCollection = new NameValueCollection();
                    conditionCollection.Add(TASK_Question.n_.ContactPhone, TxtPhone.Text);
                    ListHistoryReplyEvent(this, new HistoryReplyEventArgs(conditionCollection));
                }
            }
        }
父:
Task_Reply1.ListHistoryReplyEvent += ListHistoryEmailReply;

 protected void ListHistoryEmailReply(object sender, CSPlatform.Website.Admin.Controls.HistoryReplyEventArgs e)
        {
            //历史回复
            DataTable DT = this.TaskContext.Task.ListTaskQuestion(e.ConditionCollection, 5);
            RepEmailHistory.DataSource = DT;
            RepEmailHistory.DataBind();
        }

控件页
 public class HistoryReplyEventArgs : EventArgs
    {
        NameValueCollection _ConditionCollection;
        public NameValueCollection ConditionCollection
        {
            get { return this._ConditionCollection; }
        }
        public HistoryReplyEventArgs(NameValueCollection conditionCollection)
        {
            this._ConditionCollection = conditionCollection;
        }
    }
    public partial class Task_Reply : System.Web.UI.UserControl
    {
        public delegate void ListHistoryReplyHandler(object sender, HistoryReplyEventArgs e);
        public event ListHistoryReplyHandler ListHistoryReplyEvent;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                GameBind();
            }
        }

  protected void Button4_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(TxtPhone.Text))
            {
                if (this.ListHistoryReplyEvent != null)
                {
                    NameValueCollection conditionCollection = new NameValueCollection();
                    conditionCollection.Add(TASK_Question.n_.ContactPhone, TxtPhone.Text);
                    ListHistoryReplyEvent(this, new HistoryReplyEventArgs(conditionCollection));
                }
            }
        }
父:
Task_Reply1.ListHistoryReplyEvent += ListHistoryEmailReply;

 protected void ListHistoryEmailReply(object sender, CSPlatform.Website.Admin.Controls.HistoryReplyEventArgs e)
        {
            //历史回复
            DataTable DT = this.TaskContext.Task.ListTaskQuestion(e.ConditionCollection, 5);
            RepEmailHistory.DataSource = DT;
            RepEmailHistory.DataBind();
        }