<form id="Form1" method="post" runat="server"> <asp:TextBox id="txbTitle" runat="server"></asp:TextBox> <asp:Button id="btnSearch" runat="server" Text="Go!" ></asp:Button></form>网页右边是一个Iframe name="Right" 怎样让TextBox的内容传给Search.aspx,再在Iframe中显示搜索结果???
public static string search;
search = txbTitle.Text;if(search != null){
xxx=select * from xxx where xxx='"+search+"';
}
btnSearch.Attributes.Add("onclick","document.all('Right').src='xxx.aspx?txbTitle=" + document.all('txbTitle').value + "';return(flase);");
这样,当点击的时候,此页面并不会提交,并且,你的iframe的Src页面,将重新改变,并且获取当前页面中的输入框的值.此时,你在此iframe所指向的页面中如下取值
xxx.aspx
string txbTitle = this.Request.QueryString["txbTitle"]
即可取到传递来的值.
<form runat="server" onsubmit="this.action='xxx.aspx';">
在xxx.aspx中Request.Form来获取数据
这个不能解决xxx.aspx显示在Iframe中用Response.Redirect又没有Target的属性,我还能怎么做?
这一句加在哪?
btnSearch.Attributes.Add("onclick","document.all('Right').src='xxx.aspx?txbTitle=" + document.all('txbTitle').value + "';return(flase);");
加在Page_Load中为什么说字符文本中字符太多。
以下是实现方法 框架网页之间的表单的文本框之间数据传递.
注意的地方是框架的写法:<frameset cols="505,505">
<frame src="test.htm" name="leftr" id="leftr">//定义框架的名称
<frame src="test2.htm" id="right" name="right">
</frameset>
<noframes><body></body></noframes>
具体的实现代码如下:
<script language="JavaScript">
function ok()
{
parent.leftr.document.form2.textfield2.value=document.form1.textfield.value
}
</script>不过 我想ASP。net 肯定会提供一套自己的解决办法。我这个想法可能有点另类。
<frameset border="0" rows="30%,*" framespacing="0" frameBorder="0" id="frame">
<frame name="top" src="QueryThesis.aspx" >
<frame name="main" src="ThesisResult.aspx">
</frameset>
采用的是url传值,在ThesisResult.aspx中接收,但打开划分页的时候,上面的ftame是正常显示的,但下面的就是缺少参数,象string txbTitle = this.Request.QueryString["txbTitle"]
,接受不到,就抱错,应该怎么样解决啊?楼住,借宝地一问,共同学习哈!
mainFrame为框架名
btnSearch.Attributes.Add("onclick","document.all('Right').src='xxx.aspx?txbTitle=" + document.all.txbTitle.value + "';return(flase);");
----------------------------------------------------------------
原贴内容:
btnSearch.Attributes.Add("onclick","document.all('Right').src='xxx.aspx?txbTitle=" + document.all('txbTitle').value + "';return(flase);");我回去了再试试。
我上述的改法,即基于此点,直接把单引号值去除.其实也可如下:
btnSearch.Attributes.Add("onclick","var tmp=document.all('txbTitle').value;document.all('Right').src='xxx.aspx?txbTitle=" + tmp + "';return(flase);");
类、结构或接口成员声明中的标记“(”无效
类、结构或接口成员声明中的标记“+”无效就是这个:
btnSearch.Attributes.Add(
document.all('txbTitle').value +
<form runat="server" onsubmit="this.action='xxx.aspx';">
在xxx.aspx中Request.Form来获取数据
这个不能解决xxx.aspx显示在Iframe中用Response.Redirect又没有Target的属性,我还能怎么做?------------------------------------------------------------
看楼主的意思,似乎是要把数据提交到iframe?那设置<form>的Target参数等于iframe的name就可以了啊。
框架页:
<body>
<form id="Form1" method="post" runat="server">
<iframe align="left" id="Left" scrolling="auto" src="Left.aspx"></iframe>
<iframe align="right" id="Right" scrolling="auto" src="Right.aspx"></iframe>
</form>
</body>
left.aspx页:
<body>
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P>
<P><INPUT type="button" value="Button" onclick="top.Right.document.location='right.aspx?R='+TextBox1.value;"></P>
</FONT>
</form>
</body>
Right.aspx页:
在form_load事件中获取参数R的值查询数据并显示查询结果。