我有一个页面A, 其中有一个TEXTBOX 名称:txt1,一个LinkButton名称:lbt,还有一个页面B,我想在页面A 中单击LinkButton弹出页面B 然后在页面B中给页面A的TEXTBOX赋值,我该如何做呢?

解决方案 »

  1.   

    我这边一使用window.showModalDialog("Act_sel.aspx");语句整个页面全部刷新没了
      

  2.   

    winow.open()就可以了在页面B中使用winow。opener。document.form1.textBox1.text = "Hello World"即可
      

  3.   

    用HTML控件如何这种操作用服务器控件挺被动的@_@
      

  4.   

    server.transfer可以打开页面,那么页面B结束后如何关闭呢
      

  5.   

    在你的A页面上定义一个function evaluate(a)用来对你的textbox赋值,
    LinkButton调用 function b() open页面B,
    然后在B提交后调用一下的js程序
    opener.evaluate(document.BForm.Btextbox.value);
    window.close();
      

  6.   

    把LinkButton添加一个客户事件onclick,在事件里写JS,要不就用HTML控件处理,在新开的页面中用JS来回填数据,ShowModalDialog可在A页面后通过返回值来操作
      

  7.   

    1、URL:Response.Redirect("*.aspx?id = "+value+);取值Request["id"];
    2、Session:Session["id"] = value;取值Session["id"];
    3、Cookie:同上
    4、Cache:同上
      

  8.   

    如果你页面上的对象设置为public的话,你就可以传递他们在页面间。在页面间传递是使用
    Server.Transfer替代Response.Redirect就可以。
    例子: -------------In Page A codebehind: public class PageA : System.Web.UI.Page 

    public System.Web.UI.WebControls.TextBox TextBox1; 
    public System.Web.UI.WebControls.Button Button1; // standard page code (Page_Load, etc) 
    // .... 
    // .... private void Button1_Click(object sender, System.EventArgs e) 

    Server.Transfer("b.aspx"); 


    -------------In Page B codebehind: 
    private void Page_Load(object sender, System.EventArgs e) 

    PageA myAPage = Context.Handler as PageA; 
    string textboxFromPageA = myAPage.TextBox1.Text; 
    } 因为当使用Server.Transfer时所有的对象(A and B)在服务器上当时都是活动的,你可以引用任何东西。稍微修改一下b.aspx(uestc95 提供):Page myPage =(Page) Context.Handler; 
    string textboxFromPageA;
    textboxFromPageA = ((TextBox)myPage.FindControl("TextBox1")).Text; 
    这样在A.aspx中就可以正常的使用protected类型的了。