在WEB窗体中有两个页面,且两个页面都是用框架做成的,我想把一个页面中的文本框(包含在框架中)的值传到另一个窗体中,该如何实现,谢谢!

解决方案 »

  1.   

    1.使用javascript 脚本实现frameset之间的数据传递
    2.使用asp.net的session变量或queststring实现传递,但需要刷新页面
      

  2.   

    parent.frame2.xxx = ...
    parent.frame2.location = "x.aspx?id=" + id;
    等等很多的
      

  3.   

    1、js
    用top找到顶级窗口,然后再找到你想要得窗口,就可以给里面的控件付值了
    top.frame2.document.XXXX2、用session
    在一个页面session["id"] = "id"
    另一个页面string str = session["id"].tostring()3、url传值
    用Request[""]接收
      

  4.   

    主页面:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>New Page 1</title>
    </head>
    <frameset rows="*,49%">
    <frame src="1.htm" scrolling="auto" name="form1">
    <frame src="2.htm" scrolling="auto" name="form2">
    </frameset>
    </html>框架1页面:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>New Page 2</title>
    <script>
    function TransferValue()
    {
      window.parent.form2.T1.value = T1.value
    }
    </script>
    </head>
    <body>
    <p><input type="text"   name="T1" size="20" value="test"></p>
    <p><input type="button" name="button1" value="Transfer" onclick="javascript: TransferValue()"></p>
    </body>
    </html>框架2页面:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>New Page 3</title>
    </head>
    <body>
    <p><input type="text" name="T1" size="20"></p>
    </body>
    </html>
      

  5.   

    1、js
    用top找到顶级窗口,然后再找到你想要得窗口,就可以给里面的控件付值了
    top.frame2.document.XXXX2、用session
    在一个页面session["id"] = "id"
    另一个页面string str = session["id"].tostring()3、url传值
    用Request[""]接收===============都可以的===============
      

  6.   

    假设我有两个WEB页面,Frame1.aspx和Frame2.aspx 在Frame1.aspx里面有一个框架集,有两个页面 F1.html和F2.html.在Frame2.aspx里面也有一个框架集,也有两个页面 A1.html 和A2.html 我想把A2.html里面的值传到Frame1.aspx里面有的F2.html文本框里面,该怎么做??谢谢!!
      

  7.   

    public static 我一直用它!
      

  8.   

    如果你是重新开一个IE的话你可以用URL进行传值啊
    如果那值不太复杂的话
      

  9.   

    不到万不得以最好不要用static
      

  10.   

    string sUrl = "WebForm2.aspx?";
    sUrl += "test1="+this.TextBox1.Text.Trim();
    sUrl += "&test2="+this.TextBox2.Text.Trim();
    sUrl += "&test3="+this.TextBox3.Text.Trim();
    Response.Write("<script language=\"javascript\">window.open('" + sUrl + "');</script>");
    这段代码在Form1的Button的单击事件里
    TextBox1,TextBox2,TextBox3都是拖上来的TextBox,Button你就自己拖一来好了
      

  11.   

    this.Label1.Text = this.Request["test1"].ToString();
    this.Label2.Text = this.Request["test2"].ToString();
    this.Label3.Text = this.Request["test3"].ToString();
    这段代码在Form2的Load事件中
    Label1,Label2,Label3都是拖上来的Label
      

  12.   

    把你要打开的地址写在最前面
    第一个参数前用?
    多个参数间用&
    sUrl内不能有空格
      

  13.   

    top.Frame1.F2.document.textbox1.value=xxxx
      

  14.   

    那你就把我的WebForm2.aspx换成你的那个框架的完整名字啊
      

  15.   

    可以直接在codebehind的cs文件中写代码,把textbox.text直接传到另一个webform.
    或者用带参数的url来传,不过感觉不太好.
      

  16.   

    不是呀,我的textbox和按钮都是包含在html页面里面的,然后嵌在框架里面的
      

  17.   

    终于试出来了可以用Session来传值
    传值的时候用
    string sUrl = "Frameset2.htm";
    Response.Write("<script language=\"javascript\">window.open('" + sUrl + "');</script>");
    Session["test1"] = this.TextBox1.Text;
    Session["test2"] = this.TextBox2.Text;
    Session["test3"] = this.TextBox3.Text;
    接值的时候用
    this.Label1.Text = Session["test1"].ToString();
    this.Label2.Text = Session["test2"].ToString();
    this.Label3.Text = Session["test3"].ToString();
    如果还有么问题可以在CSDN上给我留言
    以后也可以多交流交流
    要是我有么不知道的也会上来问你们的
      

  18.   

    用超链接,target="另一个框架的名字",就可以拉
    用window.open,  window.open(url, "另一个框架的名字");
    用session或cookies直接用就可以拉.