好像没有什么难度嘛。就用session,很好的方法。

解决方案 »

  1.   

    关键是要重新绑定啊,当然可以用session拉,但是我问题的是要加一个button来获取参数啊,这样很麻烦啊,我不想加一个button啊你有什么好办法啊!
      

  2.   

    参数传递的方法一般常见的有三种情况来着!比较常用的是用Session!
    eg.Session["temp"]=Text2.Text.Trim();
      

  3.   

    我就是用session来传递的,关键是回传参数后,要求原来页面的内容不能改变啊,我在问题中用的两种返回方式中都是用session来传递的,但是主要是回传后页面1应该怎样绑定啊,我说了,难道真的要加一个button来实现对textbox1进行重新绑定?
    ————————————————————————————————
    希望大虾们能够明白我的意图!!!
    同时感谢以上各位大虾的指点!!!
      

  4.   

    可不可以采用弹出对话框的方式嘛?那样就可以
    页面1:
    有两个文本框textbox1,textbox2,一个button
    其中文本框textbox2已经输入数据,
    点击button进入页面2获取参数,并传递给页面1中的textbox1。要求返回时页面1中的textbox2中的内容不能变。
    方法一:若采用Response.Redirect("WebForm1.aspx")则textbox2中的内容不能保存
    方法二:若采用Response.Write( "<script> history.go(-2); </script>" )则必须添加一个button来获取传递过来的参数!请问大家有没有更好的办法。
    所以说的这么复杂,主要是因为textbox2中的内容是从数据库中绑定的,需要从第三个页面传递来的一个参数,所以采用方法一时无法再对textbox2绑定了!!!
      

  5.   

    我用window.open的方法打开后却不能关闭,不知道为什么?
    String sUrl = "WebForm4.aspx?Id=" + TextBox1.Text;
    String sFeatures = "'height=320;width=160;left=100;top=50;location=no;menubar=no;resizable=yes;scrollbars=no;status=no;titlebar=yes;toolbar=no'";
    String sScript ="";
    sScript += "<script language=javascript>";
    sScript += "window.open('" + sUrl + "',''," + sFeatures + ");";
    sScript += "</script>";
    Response.Write(sScript);————————————————————————————————String sId = TextBox2.Text;
    String sScript = "";
    sScript += "<script language=javascript>";
    sScript += "  window.opener.Form1.TextBox2.value = '" + sId + "';";
    sScript += "  window.close();";
    sScript += "</script>";
    Response.Write(sScript
      

  6.   

    to imfine()
    但是页面1有好几个页面都要定向到他上面,所以不能把所有的代码都放到page_load里面啊!
    private void Page_Load(object sender, System.EventArgs e)

    if(!IsPostBack)
    {
    //string member = Request.QueryString.Get("Member");
    string draftID=Request.QueryString.Get("DraftID");
                    string sendMailID=Request.QueryString.Get("SendMailID");
    string str1=Request.QueryString.Get("str1");

    if(sendMailID!=null)
    {
    this.BindData2(Convert.ToInt32(sendMailID));
    }
    if(draftID!=null)
    {
    this.BindData1(Convert.ToInt32(draftID));
    }
    if(Session["to"]!=null || Session["cc"]!=null || Session["bcc"]!=null)
    {
    if(sendMailID!=null)
    {
    this.BindData2(Convert.ToInt32(sendMailID));
    }
    if(draftID!=null)
    {
    this.BindData1(Convert.ToInt32(draftID));
    }
    if(Session["to"]!=null)
        {
       TextBox1.Text=Session["to"].ToString();
       Session.Remove("to");
        }
        if(Session["cc"]!=null)
        {
       TextBox2.Text=Session["cc"].ToString();
       Session.Remove("cc");
        }
    if(Session["bcc"]!=null)
    {
    TextBox3.Text=Session["bcc"].ToString();
    Session.Remove("bcc");
    }

    }
    } // 在此处放置用户代码以初始化页面
    }
      

  7.   

    上面是页面的代码,各位大虾看如何实现啊其中(Session["to"], Session["cc"],Session["bcc"])是从页面2传过来的,SendmailID是从页面3传过来的,draftID是从页面4穿过来的,程序先从页面3或页面4定向到页面1,并绑定数据到TextBox2,然后到页面2选择所要的数据,然后返回页面1,并绑定数据到TextBox1中!!!
      

  8.   

    to arbinger(阿彬哥)
    那要怎么保存页面3/4中的变量,难道又要用session?
      

  9.   

    在A页面中用JAVASCRIPT弹出B页面
    Response.Write("<script Language=JavaScript>");
    string url="B.aspx
    Response.Write("ChildWindow = window.open('"+url+"', '111', 'width=220,height=200,top=180,left=280,toolbar=no,status=yes,location=no,menubar=no,directories=no,scrollbars=no,resizable=no')");
    Response.Write("</script>");
    在B页面中用JAVASCRIPT回传参数
    Response.Write("<script Language=JavaScript>");
    Response.Write("window.opener.document.forms['newmessage'].elements['Return'].value ='"你要回传的STRING"';");
    Response.Write("window.close();");
    Response.Write("</script>");Return是A页面中的TEXTBOX 的ID,newmessage是A页面
      

  10.   

    to imfine()
    请问大虾你是不是用的windows窗体做的啊,我的弹出页面2后,就不能关闭了不知道为什么?