回复:如何返回上一页并保留所有输入的信息 [英] Re: How to go back to previous page and keep all entered infomation

查看:61
本文介绍了回复:如何返回上一页并保留所有输入的信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何返回上一页并在asp.net中保留所有输入的信息请尽快帮助我

解决方案

我们有很多国家管理技术。

使用任何客户端/服务器端状态管理技术来实现您的目标。



以下是使用Cross的代码页面回发:

以下是Form1的代码:

这里我使用LinkBut​​ton转到第二表格。

< pre lang =HTML> < asp:LinkBut​​ton ID = LinkBut​​ton1 runat = server PostBackUrl = 〜/ CrossPagePostback_Form2.aspx > 转到Form2 < / asp:LinkBut​​ton >
< br / >
< br / >
< asp :TextBox ID = txtTest runat = server > < / asp:TextBox >





现在是第二种形式我只是用一个标签来显示价值第一种形式的TextBox:

  protected   void  Page_Load( object  sender,EventArgs e)
{
if (PreviousPage != null
{
TextBox txtTest =(TextBox)PreviousPage.FindControl( txtTest);
Label1.Text = txtTest.Text;
}
}





这是使用CrossPage Postback访问上一页中的数据的过程。 />
为了更好地理解CrossPage回发,您可以参考以下链接:

ASP.NET网页中的跨页面发布 [ ^ ]



问候。


我想我们可以通过将enable view state属性设置为true来实现,如果它不起作用,你可以使用会话管理技术,即如果你想将数据从一个表单传输到另一个表单


您应该将以前的页面数据存储在缓存中。

维基百科:缓存(计算) [ ^ ]



这是一些假装:

MSDN:ASP.NET缓存概述 [ ^ ]

MSDN:ASP.NET缓存 [ ^ ]

MSDN:ASP.NET缓存功能 [ ^ ]



并且还可以看到:

ASP.NET - 数据缓存 [ ^ ]



--Amit


How to go back to previous page and keep all entered infomation in asp.net please help me as soon as possible

解决方案

We have a lot of State Management techniques.
Use any of Client Side/Server Side State Management techniques to achieve your goal.

Here is the Code to Work with Cross Page postback:
The Following is the Code for Form1:
Here I''m using a LinkButton to go to 2nd Form.

<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/CrossPagePostback_Form2.aspx">Go To Form2</asp:LinkButton>
        <br />
        <br />
        <asp:TextBox ID="txtTest" runat="server"></asp:TextBox>



Now in 2nd Form I''m just using a Label to Show the Value of TextBox present in 1st Form:

protected void Page_Load(object sender, EventArgs e)
    {
        if (PreviousPage != null)
        {
            TextBox txtTest = (TextBox)PreviousPage.FindControl("txtTest");
            Label1.Text = txtTest.Text;
        }
    }



This is the Process to access data present in Previous Page using CrossPage Postback.
For better Understanding of CrossPage postback you ca refer the following link:
Cross-Page Posting in ASP.NET Web Pages[^]

Regards.


i guess we can do it by setting enable view state property to true, and if it doesn''t works you can go for session management technique i.e. if you want to transfer data from one form to another


You should store your previous page data in Cache.
Wikipedia : Cache (computing)[^]

Here is some ovservations:
MSDN : ASP.NET Caching Overview[^]
MSDN : ASP.NET Caching[^]
MSDN : ASP.NET Caching Features[^]

And also see:
ASP.NET - Data Caching[^]

--Amit


这篇关于回复:如何返回上一页并保留所有输入的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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