!!!aspx文件之间参数传输问题,高分求助!!!

ywcyj 2003-07-01 02:02:31
有两个文件:test1.aspx,test2.aspx
1、点击test1.aspx的Button1,弹出test2.aspx页面,并将test1.aspx中a,b的值传给test2.aspx。
2、点击test2.aspx的Button2,将test2.aspx中c的值返回给test1.aspx,关闭test2.aspx页面
第一步已经完成,代码如下:
test1.aspx
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Single
Dim b As Single
a = 1
b = 2
Dim sURL As String
Dim strItem As String
sURL = "test2.aspx?a=" + a.ToString + "&b=" + b.ToString
strItem = "<script language=JavaScript>window.open('" + sURL + "','', 'height=500, width=500, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no');</script>"
Response.Write(strItem)
End Sub
test2.aspx
Dim a As Single
Dim b As Single
a = Page.Request("a")
b = Page.Request("b")
TextBox1.Text = a.ToString
TextBox2.Text = b.ToString

第二步咋写?
哪位帮我提供一段代码吧
谢了先
...全文
45 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
ywcyj 2003-07-07
  • 打赏
  • 举报
回复
谢谢goody9807()
已经搞定
goody9807 2003-07-04
  • 打赏
  • 举报
回复
webform1.aspx
page_load

Button1.Attributes.Add("onclick", "var st=window.showModalDialog('user.aspx?val='+document.all('TextBox1').value);document.all('TextBox2').value=st;return st;")
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:button id="Button1" style="Z-INDEX: 101; LEFT: 226px; POSITION: absolute; TOP: 308px" runat="server" Text="submit"></asp:button>
<asp:Button id="Button3" style="Z-INDEX: 105; LEFT: 88px; POSITION: absolute; TOP: 16px" runat="server" Text="Button"></asp:Button><asp:textbox id="TextBox1" style="Z-INDEX: 103; LEFT: 86px; POSITION: absolute; TOP: 209px" runat="server"></asp:textbox><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 255px; POSITION: absolute; TOP: 213px" runat="server" Height="4px" Width="78px">back value:</asp:label>
<asp:Button id="Button2" style="Z-INDEX: 104; LEFT: 334px; POSITION: absolute; TOP: 309px" runat="server" Text="close" Height="23px" Width="70px"></asp:Button>
<asp:TextBox id="TextBox2" style="Z-INDEX: 106; LEFT: 331px; POSITION: absolute; TOP: 206px" runat="server" Height="28px" Width="101px"></asp:TextBox></form>
</body>


user.aspx
RegisterStartupScript("key", "<script>window.returnValue=document.all('TextBox1').value;window.opener=null;window.close(this);</script>"
goody9807 2003-07-04
  • 打赏
  • 举报
回复
是不是报b is not defined 的错误提示
ywcyj 2003-07-04
  • 打赏
  • 举报
回复
楼上的兄弟,出了点小问题
ie 脚本错误
缺少对象
http://localhost/test1/user.aspx?val=10

textbox2显示undefined
goody9807 2003-07-04
  • 打赏
  • 举报
回复
行了吗 ,我式了,肯定行
ywcyj 2003-07-03
  • 打赏
  • 举报
回复
要求:
1、点击test3.aspx的Button1,读取TextBox1的值,赋给a,弹出test4.aspx,将a值传给test4.aspx。
2、点击test4.aspx的Button1,将计算(+100)所得的b值返回给test1.aspx,关闭test2.aspx。
3、test1.aspx获得b值后,将其赋给TextBox1,自动更新,在页面上显示出来。
代码如下:
test3.aspx:

Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Single = CSng(TextBox1.Text) 'TextBox1.Text为10
Dim sURL As String
Dim strItem As String
sURL = "test4.aspx?a=" + a.ToString
strItem = "<script language=JavaScript>window.showModalDialog('" + sURL + "','', 'dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;');</script>"
Response.Write(strItem)
End Sub

test4.aspx:

Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim b As Single
b = Request.QueryString("a")
b += 100
Response.Write("<script language=JavaScript>window.returnValue = b.ToString();window.close();</script>")
End Sub

说明:test4.aspx已经添加<base target="_self">,但还是一提交就重新打开一个页面
第一次用模态窗口,不会.
各位高手帮我写完整吧!谢了先
goody9807 2003-07-03
  • 打赏
  • 举报
回复
1.window.showModalDialog("DialogPage.aspx","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");

2.window.close();

3.传值
ParentPage.aspx:
window.showModalDialog("DialogPage.aspx?para1=aaa¶2=bbb");

DialogPage.aspx:
string str1=Request.QueryString["para1"].toString();
string str2=Request.QueryString["para2"].toString();

返回值
DialogPage.aspx:
window.returnValue="aaa";

ParentPage.aspx:
var str=window.showModalDialog("DialogPage.aspx");

4.
aspx页面在showmodeldialog情况下为什么一提交就重新打开一个页面?
showmodaldialog打开的页面中在<head></head>之间加入一行:<base target="_self">
ChenHaiHua 2003-07-02
  • 打赏
  • 举报
回复
up CSTerry(Terry)
在HTML中写代码,比较方便,
airon2002 2003-07-01
  • 打赏
  • 举报
回复
参数值回传是吧。看看 原来的asp与jacascript写的你就会明白了,不用那么麻烦。我没时间所以不帮你写了,你先看看

//第一个文件
<form name=auth_form method=post><input type=hidden name=userInfo value=''></form><script>
var temp=new Array();
temp[0]='default.htm';
temp[1]='loginBsSystem';///Maintenance';
temp[2]='0';
temp[3]='';

var userInfo;
var undefined;
var ll=(screen.width-400)/2;
var tt=(screen.height-210)/2;

userInfo=window.showModalDialog ('login.asp',temp,'dialogHeight:210px;dialogWidth:400px;dialogTop:' + tt +';dialogLeft:' + ll + 'px;status:no;scroll:no');
if(userInfo==undefined)
{
window.open('error/errorCancel.html','_top','');
}
else
{
auth_form.action='loginBsSystem/check.asp';
auth_form.userInfo.value=userInfo;
auth_form.submit();
}
</script>

//========下面为第二个文件


<SCRIPT>
var back=new Array()
back=window.dialogArguments

if(back[3] != "") window.alert(back[3])
function on_submit()
{
window.returnValue=myform.username.value+"-"+myform.password.value+"-"+back[0]+"-"+back[1]+"-"+back[2]
self.close()
}
</SCRIPT>
CSTerry 2003-07-01
  • 打赏
  • 举报
回复
在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页面
ywcyj 2003-07-01
  • 打赏
  • 举报
回复
要求返回原来的test1.aspx,而不是新开一个页面

高手们都不在吗?

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧