asp.net/c#
创建2个web窗口
当我按下第一个页面的按钮,跳转到第二个页面。
怎么样把第一个页面的值传到第二个页面呢?

解决方案 »

  1.   

    汗,这个比如 index.aspx?id=5  这个就是传值的,然后再下一个页面用request 接收就是
      

  2.   

    用Session["id"]=1;
    然后另外一个页面
    if(Session["id"]!=null)
    {
    //取值
    }
    还可以用URL如楼上所说
      

  3.   

    http://blog.csdn.net/smallkonrad/archive/2008/12/27/3623057.aspx
      

  4.   

    session,response,application,cookie,request,transfer都可传值
      

  5.   

    比如,
    假设你的第一个页面为1.aspx,这个页面中包含有一个textBox1和一个button1
           第二个页面为2.aspx,这个页面中包含有一个label1
    这样,当你点击button1时,在button1的Click中事件中,可以这样写:
    protected void button1_Click(object sender, EventArgs e)
    {
        String t = this.textBox1.Text;
        Response.Redirect("~/2.aspx?id=" + t);
    }在第二个页面2.aspx中,可以在页面初始化时,将第一个页面中的textBox1的值赋给label1,
    代码:protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           object o = Request.QueryString["id"];
           if(o != null)
           {
              this.lalel1.Text = o.ToString();
           }
        }
    }