父页面
有个按钮 有个label
后台代码:
public partial class test_resParentPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = test.strName;
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(
"<script>window.open('SunPage.aspx','_blank','height=450,width=470,status=no,toolbar=no,menubar=no,scrollbars=no,location=no');
</script>");/
}
}
子页面
有个按钮(用来关闭子页面并刷新父页面)
后台代码:
public partial class test_SunPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
test.strName = TextBox1.Text.Trim();
Response.Write("<script>window.opener.refresh();window.opener=null;window.close();</script>");
}
}
本文介绍了一个ASP.NET页面间的交互示例,包括一个父页面和一个子页面。父页面包含一个按钮和一个标签,子页面也有一个按钮用于关闭自身并刷新父页面。通过响应式脚本实现了页面之间的数据传递和状态更新。
849

被折叠的 条评论
为什么被折叠?



