页面与弹出穿口之间相互传值的问题? 当前页面currentPage.aspx中点击按钮,将currentPage.aspx上的lblCategoryID传到弹出的dialog.aspx页面(dialog.aspx这个页面是弹出窗口的样式,比较小,)。关闭dialog.aspx时将上面的ddlProduct的值给带回currentPage.aspx页面上去。简而言之,就是两个页面相互传递值的问题,并且都是aspx页面,并且都要读取后台的数据库。求助。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 采用opener这种方式如A打开B,那B要取得A的数据window.opener.document.getElementById("对象").value相反,返回也一样。 var a=document.getElementById("lbl").InnerText; URL = "dialog.aspx?s" + a;myleft = (screen.availWidth - 500) / 2;window.open(URL, "read_comment", "height=500,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=100,left=" + myleft + ",resizable=yes");dialog.aspxwindow.opener.document.getElementById("textbox1")value=""; 楼主先做个简单的实验,理解了就可以应用到知己的程序中!如:currentPage.aspx页面代码:<input type="text" id="Text1" /> <%--这是接受dialog.aspx返回值,今后改成隐藏域--%><asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="打开页面" />currentPage.aspx C#代码: protected void Button1_Click(object sender, EventArgs e) { string lblCategoryID="10"; Page.ClientScript.RegisterStartupScript(Page.GetType(), "", " window.showModalDialog('dialog.aspx?cId=" + lblCategoryID + "',document.getElementById('Text1'));", true); }dialog.aspx页面代码:<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <base target="_self" /> <%--这句必须要有--%></head><body> <form id="form1" runat="server"> <input type="text" id="Text2" runat="server"/> <%--返回值,今后改成隐藏域--%> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="关闭页面" /> </form></body></html>dialog.aspx C#代码: protected void Page_Load(object sender, EventArgs e) { Response.Write(Request.QueryString["cId"].ToString());//接受currentPage.aspx值 } protected void Button1_Click(object sender, EventArgs e) { Text2.Value = "我的返回值"; Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "window.dialogArguments.value = document.getElementById('Text2').value;window.close()", true); } 我想实现【点击小图出现大图】的效果,高人指教..急!!!谢谢啦~ 把原本能运行的程序放到另一台电脑上,出现好多错啊,从网上下的那些DLL控件都引用不上了 iframe查询结果取值问题. 用户单击按钮,回传的过程到底是怎么回事 如何用ASP.NET打开本地WORD文档 一个看似简单的问题困扰了一个月,在vs.net中连接数据库 关于ASP。NET数据库依赖缓存 每当我刷新的时候,还是显示的是原来的数据?那浏览球的刷新功能还有什么用呢? 二进制读取图片无法正常显示 在进行设计时候遇到这样的错误,不知如何修改?请各位大侠出手援助: 编码问题 IIS发布网站后,login控件总是登陆失败,快崩溃了
如A打开B,那B要取得A的数据
window.opener.document.getElementById("对象").value相反,返回也一样。
URL = "dialog.aspx?s" + a;
myleft = (screen.availWidth - 500) / 2;
window.open(URL, "read_comment", "height=500,width=550,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=100,left=" + myleft + ",resizable=yes");
dialog.aspx
window.opener.document.getElementById("textbox1")value="";
currentPage.aspx页面代码:
<input type="text" id="Text1" /> <%--这是接受dialog.aspx返回值,今后改成隐藏域--%>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="打开页面" />currentPage.aspx C#代码:
protected void Button1_Click(object sender, EventArgs e)
{
string lblCategoryID="10";
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", " window.showModalDialog('dialog.aspx?cId=" + lblCategoryID + "',document.getElementById('Text1'));", true);
}dialog.aspx页面代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<base target="_self" /> <%--这句必须要有--%>
</head>
<body>
<form id="form1" runat="server">
<input type="text" id="Text2" runat="server"/> <%--返回值,今后改成隐藏域--%>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="关闭页面" />
</form>
</body>
</html>dialog.aspx C#代码:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.QueryString["cId"].ToString());//接受currentPage.aspx值
}
protected void Button1_Click(object sender, EventArgs e)
{
Text2.Value = "我的返回值";
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "window.dialogArguments.value = document.getElementById('Text2').value;window.close()", true);
}