日期:2014-05-18  浏览次数:20440 次

一个查询页面求解决方法!

<html >
<head runat="server">
  <title>Untitled Page</title>
</head>
<body>
  <form id="form1" runat="server">
  一些用于录入查询页面的文本框。。。。。
  <input id="Button4" type="button" value="查询" />
  <iframe src="装载查询结果的页面"></iframe>
   
  </form>
</body>
</html>

我要的功能是,页面载入时把数据库中的所用信息都显示出来,
点查询后根据用户输入的查询条件把结果装载查询结果的页面中!!
------------------------------------------
我现在的想法是在第一次载入时 在装载查询结果的页面 的Page_Load 中把所有信息显示出来!

用户点击查询时就用js 的open()方法打开装载查询信息的页面,并通过url把查询条件传过去,
再构造sql语句从数据库中查询信息!!但这是就不知道在那里去处理了,也在Page_Load中?
不行啊?因为上面的显示所有信息已经在Page_Load中处理了!!用 IsPostBack也不行了,因为
open()是重新打开窗口了!!

怎样解决呢??谢谢




------解决方案--------------------
就在Page_Load 中处理,判断条件
------解决方案--------------------
<iframe name="idFrame1" src="WillOpen.aspx?where=<%= where %>" width="100%" height="570" frameBorder="0" marginwidth="0" marginheight="0">
</iframe>

然后在Page_Load()
string strWhere=Request.QueryString["where"];
以strWhere为条件,再次绑定数据即可
------解决方案--------------------
html:
 <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" />

cs:
protected void Button2_Click(object sender, EventArgs e)
{
Session["value"]=" itemname like '%" + this.TextBox1.Text + "%'";
ScriptManager.RegisterClientScriptBlock(this,this.GetType(),"","fun()",true);
}

js:<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function fun()
{
var Url="Default4.aspx";
newwin=window.open(Url,'',"_VOSFullScreen,scrollbars=yes","scrollbar");
newwin.moveTo(0,0);
newwin.resizeTo(screen.availWidth-50,screen.availHeight-50);
}
</script>
</head>
------解决方案--------------------
显示查询结果楼主为什么要用iframe嵌套另外一个页面,而不在同一个页面里把问题解决呢?
可以用一个datagrid控件来显示查询结果呀。
------解决方案--------------------
1.在主页面的form属性中这样设置:<form id="form1" runat="server" action="iframe的页面名称"> 
2.在iframe页接收参数,并执行查询(判断是否有参数,当没有参数时,执行显示全部列表的查询,如果有参数,则执行条件查询)