将结果重定向到一页到另一页 [英] redirecting result to one page to another

查看:86
本文介绍了将结果重定向到一页到另一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我正在搜索页面上,我使用了一个文本框和一个按钮.现在基于输入的文本,在按钮单击事件上.我想在网格视图控件的另一个asp.net页面上显示结果.我该怎么办.

在此先感谢朋友.

Hello Friends,
I am working on a search page, i have used one text box and one button .Now on the basis of text entered,on button click event.I want to show the result on an another asp.net page , in a grid view control.How can i do it.

Thanks in advance friends.

推荐答案

尝试一下,

在您的page1.aspx中,
Try this,

In your page1.aspx,
<body>
    <form id="form1" runat="server">
      <asp:TextBox ID="txt" runat="server"></asp:TextBox>
      <asp:Button ID="btn" runat="server" Text="Search" OnClick="btn_Click"/>
    </form>
</body>





在page1.aspx.cs中,





In page1.aspx.cs,

protected void btn_Click(object sender, EventArgs e)
    {

        Response.Redirect("Page2.aspx?a="+txt.Text);
    }




然后在page2.asp.cs中,
使用Request.QueryString ["a"],您将获得传递的值并使用该值查找结果.


-----------
@Nidhish




Then in page2.asp.cs,
Using Request.QueryString["a"], you will get the passed value and find the result using that value.


-----------
@Nidhish


在后面的代码中(按钮单击处理程序)

In the code behind (button click handler)

Response.Redirect("http://myotherpage.aspx")


将搜索结果保存在会话中.并在其他页面上使用此会话.对于前
将结果保存到Session("ABC")中.
然后在下一个要使用的页面上创建数据表.
DataTable dt = new DataTable();
dt = Session("ABC");

现在所有结果都在dt中.并轻松使用此页面上的DataTable值.
Save your search result in session. And use this session on other page. For ex
save result in Session("ABC").
Then next page where you want to use create data table.
DataTable dt = new DataTable();
dt = Session("ABC");

Now all result in dt. And easily use DataTable value on this page.


这篇关于将结果重定向到一页到另一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆