母板中控件的调用

来源:百度知道 编辑:UC知道 时间:2024/05/06 01:23:37
我建了一个母板,在用它生成的页面default.aspx中加入了两个BUTTON,一个TEXTBOX,有下面的代码
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "adf";
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("default2.aspx");
}
现在在页面default2.aspx中用下面的JavaScript代码后textbox1的内容怎么没有变化啊
<script type="javascript/text">
opener.button2.click();
close();
</script>
上面的问题我没有说清楚,应该是这样的:
我建了一个母板,在用它生成的页面default.aspx中加入了两个BUTTON,一个TEXTBOX,有下面的代码
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "adf";
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Write("<script type='javascript/text'>windows.open(default2.aspx);</script>");
}
现在在页面default2.aspx中用下面的JavaScript代码后textbox1的内容怎么没有变化啊
<scri

首先:使用opener的前提是当前页面是被open出来的.否则它的opener为null.
而你的代码中default2.aspx是用Response.Redirect转跳的.所以当然不行.

其次:opener.button2.click();你想做什么...?没明白.如果你想在default2中对default页面中的textbox进行操作.那直接可以写:opener.TextBox1.value="fdsafdas";