<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>index</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<Link type="text/css" rel="stylesheet" href="../css/css.css">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" style="Z-INDEX: 101" cellSpacing="0" cellPadding="0" width="100%" border="0"
height="100%" align="center">
<TR>
<TD vAlign="middle" align="center"><FONT face="宋体">
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox><BR>
<BR>
<asp:Button id="Button1" runat="server" Text="Button" CssClass="gray"></asp:Button></FONT></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace DataGridDemo.ModelWindow
{
/// <summary>
/// index 的摘要说明。
/// </summary>
public class index : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
string str = "<script language='javascript'>\r\n"+
"function openwindow(){\r\n" +
"var str = window.showModalDialog('index2.aspx', document.Form1.TextBox1.value);\r\n" + 
"if(str != null) document.Form1.TextBox1.value = str;\r\n" +
"}"
+"</script>\r\n";
if(!IsClientScriptBlockRegistered("client"))
this.RegisterClientScriptBlock("client", str);
Button1.Attributes.Add("OnClick", "openwindow()");
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}
-----------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>index2</TITLE>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<frameset rows="0,*">
<frame src="about:blank">
<frame src="http://localhost/DataGridDemo/ModelWindow/index3.aspx">
</frameset>
</HTML>
-----------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>index3</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout" id="mybody" runat="server">
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" style="Z-INDEX: 104;POSITION: static" cellSpacing="1" cellPadding="1"
width="100%" border="0" height="100%" align="center">
<TR>
<TD vAlign="middle" align="center">
<DIV style="WIDTH: 120px; HEIGHT: 40px" ms_positioning="FlowLayout">
<P><FONT style="FONT-SIZE: 12px; COLOR: black; FONT-FAMILY: 'Courier New'; TEXT-DECORATION: none">What's 
your name?</FONT>
</P>
</DIV>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<BR>
<asp:Button id="submit" runat="server" Text="submit"></asp:Button></TD>
</TR>
</TABLE>
</form>
</body>
</HTML>using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace DataGridDemo.ModelWindow
{
/// <summary>
/// index3 的摘要说明。
/// </summary>
public class index3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button submit;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.HtmlControls.HtmlControl mybody;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!IsPostBack)
{
string str = "<script language='javascript'>" + 
"window.parent.returnValue = '" + TextBox1.Text + "';\r\n" +
"window.parent.close();" +
"</script>";
if(!IsClientScriptBlockRegistered("client1"))
this.RegisterClientScriptBlock("client1", str);
}
if(!IsPostBack)
{
mybody.Attributes.Add("OnLoad", "document.From1.TextBox1.value = window.parent.dialogArguments");
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}为什么显示出来的ModelWindow里面是一片空白呢? 
而在VS.NET下面, index2.aspx里面的确是有内容的
谢谢