contents页中,button事件,this.respose.redirect(WebForm2.aspx);
Session["a"]="abc";
将 BASE target="main" 元素添加到“contents”页的
WebForm2.aspx中的page_load事件中,
this.textBox1.text=Session["a"];
Session["a"]="abc";
将 BASE target="main" 元素添加到“contents”页的
WebForm2.aspx中的page_load事件中,
this.textBox1.text=Session["a"];
<script language=javascript>
function btn_click(str)
{
//frmr -- 右边框架的id
//form1 -- b页中from的id,如果textbox不在from里,省略
window.parent.frmr.form1.textbox1.value=str;
}
</script>
<input type="button" onclick="javascript:btn_click('abc');">b.aspx
<input type="text" id=form1>
用地址栏传值应该也可以,
默认设置地址栏的值为空
在b.aspx页面的程序中把地址栏中传的值赋给TextBox
在a.aspx页面的Button的事件中重定向一个带值的地址
即可
<head>
</head>
<body>
<form runat="server">
<table height="100%" width="100%" border="1">
<tbody>
<tr>
<td>
<iframe id="frml" src="a.aspx" width="100%" height="100%">
</iframe>
</td>
<td>
<iframe id="frmr" src="b.aspx" width="100%" height="100%">
</iframe>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
a.aspx<%@ Page Language="C#" %>
<script runat="server"> // Insert page code here
//
void Page_load()
{
cmdsayhello.Attributes["onclick"]="javascript:return cmdsayhello_click()";
}</script>
<html>
<head>
<script language=javascript>
function cmdsayhello_click()
{
window.parent.frmr.form1.text1.value="hello";
return false; //返回false,阻止页面提交
}
</script>
</head>
<body>
<form runat="server">
<asp:Button id="cmdsayhello" runat="server" Text="Button"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html>
b.aspx
<html>
<head>
</head>
<body>
<form id="form1" runat="server">
<!-- Insert content here -->
<asp:TextBox id="text1" runat="server"></asp:TextBox>
</form>
</body>
</html>