以下代码在环境:Microsoft Visual Studio 2005 (Service Pack1)下测试通过,目前也应用于项目中,感觉还行
此应用有三个窗口:
第一、Windows1.aspx
<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="Windows1.aspx.cs"Inherits="TaoNet.Client.Web.Windows1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
<title>WebForm1</title>
</head>
<bodyms_positioning="GridLayout">
<divalign="center">
<formid="Form1"runat="server"method="post">
<asp:LabelID="Label1"runat="server"Font-Bold="true">
从当前页面打开新窗口,并把变量传递到新窗口的例子,可以多次打开提交。
</asp:Label><br>
<br>
<asp:TextBoxID="TextBox1"runat="server"Width="600px">这是初始值,将被传递到新窗口。</asp:TextBox><br>
<br>
<asp:ButtonID="Button1"runat="server"Text="打开窗口"Width="96px"/></form>
</div>
</body>
</html>
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
namespaceTaoNet.Client.Web
...{
publicpartialclassWindows1:System.Web.UI.Page
...{
protectedvoidPage_Load(objectsender,EventArgse)
...{
intintWidth=500;
intintHeight=400;
stringvbCrLf=" ";
//在此处放置用户代码以初始化页面
if(!IsClientScriptBlockRegistered("clientScript"))
...{
stringstrScript="<script>"+vbCrLf;
strScript+="functionOpenWin(){"+vbCrLf;
strScript+="varstr=window.showModalDialog('Windows2.aspx',document.Form1.TextBox1.value,'dialogWidth="+intWidth+"px;dialogHeight="+intHeight+"px','scroll:yes')"+vbCrLf;
strScript+="if(str!=null)document.Form1.TextBox1.value=str"+vbCrLf;
strScript+="}"+vbCrLf;
strScript+="</script>"+vbCrLf;
RegisterClientScriptBlock("clientScript",strScript);
}
Button1.Attributes.Add("onclick","OpenWin()");
//window.showModalDialog("modal.htm",obj,"dialogWidth=200px;dialogHeight=100px");
}
}
}
//------------------------------------------------------------------------------
//<auto-generated>
//此代码由工具生成。
//运行库版本:2.0.50727.42
//
//对此文件的更改可能会导致不正确的行为,并且如果
//重新生成代码,这些更改将会丢失。
//</auto-generated>
//------------------------------------------------------------------------------
namespaceTaoNet.Client.Web...{
/**////<summary>
///Windows1类。
///</summary>
///<remarks>
///自动生成的类。
///</remarks>
publicpartialclassWindows1...{
/**////<summary>
///Head1控件。
///</summary>
///<remarks>
///自动生成的字段。
///要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///</remarks>
protectedglobal::System.Web.UI.HtmlControls.HtmlHeadHead1;
/**////<summary>
///Form1控件。
///</summary>
///<remarks>
///自动生成的字段。
///要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///</remarks>
protectedglobal::System.Web.UI.HtmlControls.HtmlFormForm1;
/**////<summary>
///Label1控件。
///</summary>
///<remarks>
///自动生成的字段。
///要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///</remarks>
protectedglobal::System.Web.UI.WebControls.LabelLabel1;
/**////<summary>
///TextBox1控件。
///</summary>
///<remarks>
///自动生成的字段。
///要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///</remarks>
protectedglobal::System.Web.UI.WebControls.TextBoxTextBox1;
/**////<summary>
///Button1控件。
///</summary>
///<remarks>
///自动生成的字段。
///要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///</remarks>
protectedglobal::System.Web.UI.WebControls.ButtonButton1;
}
}
第二、Windows2.aspx
<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="Windows2.aspx.cs"Inherits="TaoNet.Client.Web.Windows2"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headid="Head1"runat="server">
<title>WebForm2</title>
</head>
<framesetrows="0,*">
<framesrc="about:blank">
<framesrc="Windows3.aspx">
</frameset>
</html>
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
namespaceTaoNet.Client.Web
...{
publicpartialclassWindows2:System.Web.UI.Page
...{
protectedvoidPage_Load(objectsender,EventArgse)
...{
}
}
}
//------------------------------------------------------------------------------
//<auto-generated>
//此代码由工具生成。
//运行库版本:2.0.50727.42
//
//对此文件的更改可能会导致不正确的行为,并且如果
//重新生成代码,这些更改将会丢失。
//</auto-generated>
//------------------------------------------------------------------------------
namespaceTaoNet.Client.Web...{
/**////<summary>
///Windows2类。
///</summary>
///<remarks>
///自动生成的类。
///</remarks>
publicpartialclassWindows2...{
/**////<summary>
///Head1控件。
///</summary>
///<remarks>
///自动生成的字段。
///要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///</remarks>
protectedglobal::System.Web.UI.HtmlControls.HtmlHeadHead1;
}
}
第二、Windows3.aspx
相关推荐
为了解决这个问题,俺花了不少时间和精力,现在解决了,贡献给大伙
asp.net mvc 弹出窗口 技巧asp.net mvc 弹出窗口 技巧asp.net mvc 弹出窗口 技巧asp.net mvc 弹出窗口 技巧
在 web应用中,比如OA中,经常要用到一些提示,比如EMAIL到达了,就做个象MSN那样的提示框,弹出给用户提示,然后再关闭。在ASP.net 2.0的ajax中,这个现在不难做到了,刚好看到老外的一篇文章,讲解到,下面小结之
asp.net(C#)里点击页面某一项,弹出对话框显示其详细信息,并可以设置自动关闭对话框的时间。
asp.net c# 电子商务网站asp.net c# 电子商务网站
主要介绍了asp.net弹出窗口 返回值,有需要的朋友可以参考一下
通过webrequest, webclient两种方式请求url获取对应的返回值
基于ASP.NET C#的全源码完整OA,包括人事管理、用户权限管理、信息发布、用车管理等内容。
asp.net C# 利用FTP 远程下载文件到指定盘符`
管理系统 mvc asp.net c# demo 示例 代码
ASP.NET JS弹出式窗口,简单,好用!弹出一个窗口,是一个新的页面!内有DEMO,看了就知道怎么用,超级简单
asp.net C# PDF阅读器源码,asp.net C# PDF阅读器源码
asp.net c# 统计图 GoogleChartSharp 含实例
asp.net(c#)图片变换局部刷新ajax.rar 用类点击目录,局部更新图片变化。
asp.net C# 网站 项目 我们老师写的,,很不错!为大家提供一个平台!!!
1. 弹出绝对居中层 2. 企业级应用标准,支持SharePoint 3. 基于ASP.ENT, JavaScript, CSS开发
asp.net C# 物业管理系统asp.net C# 物业管理系统asp.net C# 物业管理系统asp.net C# 物业管理系统
asp.net操作javascript-confirm返回值的两种方式_.docx
ASP.NET C# 在线音乐网站 下载。 其主要功能有:会员管理,添加歌曲,点歌管理,歌曲查找,留言系统,网站管理等。 音乐网站