transfer Context.Handler 页面传值

 Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=2146052

public partial class Search : System.Web.UI.Page
{
    private string _sql;

    public string SQL
    {
        get { return _sql; }
        set { _sql = value; }
    } 

void button_click()
{
       _sql = sql;
       Server.Transfer("result.aspx");}

}

 

public partial class Result: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
      if (!IsPostBack)
      {
            Search search;
            //获得实例化的句柄 
            if (Context.Handler is Search)//判断页面是否是从Search页面来的很重要
            {
                search = (Search)Context.Handler;

               Respose.Write(search.SQL);
            }
       }
}
}


你可能感兴趣的:(handler)