惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
F
Fortinet All Blogs
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
B
Blog RSS Feed
I
InfoQ
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
H
Help Net Security
L
LangChain Blog
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
aimingoo的专栏
aimingoo的专栏

博客园 - wngwz

单点登陆 - wngwz - 博客园 IP地址 - wngwz - 博客园 金额转换.小To大 - wngwz - 博客园 简,繁体转换工具. 弹出模态窗体,关闭后。重新绑定页面(这个仅仅是对粗心大意的纪录) - wngwz - 博客园 分页存储过程 关于水晶报表的版本问题! 大年30祝大家, 不知道说还要GMail的油箱! 打印的一些知识! 求助!水晶报表! 解决把水晶报表下载到客户端过程中,出现下载整个页面(.aspx)或者直接载web页中打开word文件的问题! 收获!关于引用计数器! 把文件或图片存在数据库中! 水晶报表倒出! 关于(学习!Excel)的问题。 解决问题总结 水晶报表操作中遇到的问题 javascript 打印报表!
javascript 学习
wngwz · 2004-09-07 · via 博客园 - wngwz

弹出模态窗体,并回传数值!
窗体:WebForm1.aspx; frame.aspx; WebForm2.aspx
WebForm1.aspx 窗体的Load事件中

if ( !IsPostBack)
{
    Button1.Attributes.Add(
"onclick","GetString(TextBox1)");
}

前台的javascript脚本:

function GetString(keys)
{
    keys.value 
= window.showModalDialog("frame.aspx?url=WebForm2.aspx");
}

frame.aspx 窗体的Load事件中

if(!IsPostBack)
{
    
if(Request.QueryString.Count >= 2//获得包含在传递字符串中健值对的个数。
    {
        
string Rurl = Request.QueryString["url"].ToString();
        
string paraname = Request.QueryString.GetKey(1);
        
string paravalue = Request.QueryString.Get(1);
        
string url = Rurl+"?"+paraname+"="+paravalue;
        
for(int i=2;i<Request.QueryString.Count;i++)
        
{
            url 
= url+"&"+Request.QueryString.GetKey(i)+"="+Request.QueryString.Get(i);
        }

        fraMultiSelect.Attributes.Add(
"src",url);
    }

    
else
    
{
        
//当通过WebForm1.aspx进入WebForm2.aspx时,首先要先经过这个框架窗体,才可以

        
string url = Request.QueryString["url"].ToString();
        fraMultiSelect.Attributes.Add(
"src",url);
    }

}

在前台添加

<iframe id="fraMultiSelect" width="100%" height="100%" frameborder="0" scrolling="no" runat="server"></iframe>

WebForm2.aspx

private void Button1_Click(object sender, System.EventArgs e)
{
    Response.Write(
"<script language='javascript'>");
    Response.Write(
"window.returnValue = '"+TextBox1.Text+"';");
    Response.Write(
"window.close();");
    Response.Write(
"</script>");
}