实名认证用户熊川湘 身份证号码430811198506290914

在ASP.net页面里取得用户控件里面的值

一.在用户控件里添加如下代码:

public event EventHandler gg;
  
    protected void Button1_Click(object sender, EventArgs e)
    {
        Session["ccc"] = TextBox1.Text;
      
        if (gg != null)
        {

            gg(this, e);

        }


    }

二.在引用用户控件里的代码写入(记得要在用户控件里加入刚都声明的事件)

   如: <uc1:WebUserControl ID="WebUserControl1" runat="server" Ongg ="cc"/>

    protected void cc(object sender, EventArgs e)
    {
        if (Session["ccc"] != null)
        {
            TextBox1.Text = Session["ccc"].ToString();
            Session.Remove("ccc");
        }
    }

posted @ 2009-02-26 11:16  浪达短信群发  阅读(203)  评论(0编辑  收藏  举报