父窗体打开子窗体,子窗体在打开孙子窗体的传值问题

46 篇文章 0 订阅
父窗体A打开 子窗体B,然后 子窗体B在打开 窗体C(那窗体C就算是窗体B的子窗体了),请问子窗体C该如何向窗体B传值?

具体代码:

1、父窗体A:

C# code
   
   
this .Button1.Attributes.Add( " onclick " , " window.showModalDialog('子窗体B.aspx','window','dialogWidth:880px;DialogHeight=600px;status:no;help:no;resizable:yes;');window.location='#'; " );

2、子窗体B:
HTML code
   
   
< script type ="text/javascript" > function XuanZe() { window.open( ' 孙子窗体C.aspx ' , ' newwindow ' , ' height=300,width=500,top= ' + (screen.AvailHeight - 300 ) / 2+',left='+(screen.AvailWidth-300) / 2 + ' ,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no ' ); } </ script > < asp:TextBox ID ="TextBox3" runat ="server" Width ="200px" ></ asp:TextBox > < input id ="Button3" type ="button" value ="选择" onclick ="XuanZe()" />

C# code
   
   
TextBox3.Text = Request.QueryString[ " id " ].ToString();

3、孙子窗体C:
C# code
   
   
protected void GridView1_RowDataBound( object sender, GridViewRowEventArgs e) { // 鼠标双击事件 if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add( " onDblClick " , " javascript:window.opener.location.href='子窗体B.aspx?id= " e.Row.Cells[ 1 ].Text.ToString() + " ';window.close(); " ); } }


说明:e.Row.Cells[1].Text.ToString()获取的值是"中文",但我加上Server.UrlEncode()后还是又问题,请问可以这样传值嘛?如果不行?该怎么传值.....

答案:

e.Row.Attributes.Add("onDblClick", "javascript:window.opener.document.getElementById('TextBox3').value=" e.Row.Cells[1].Text.ToString() + ";window.close();"); 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值