468,720 Members | 1,559 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

data disappearing problem on the forms when navigate

Hi all,
the data disappearing problem occurs to all my controls even my regualr web
control like asp:textbox, when I click back button in web browser from second
page to first page and then click continue button on the first page to second
page again, all the data entered , even in web server control(not user
controls defined by myself.) all disappear.
What's going on. I thought dealing with .net should be much easier, did I
miss something???
--
Betty
--
Betty
Jan 31 '06 #1
4 1702
Hi all,
I think I got it in one way. But I don't think it the best way.
in the pag_load, I just check if the session is empty or not. If not
I just reload the session variables to the controls again.
Can someone come with better solution? I am afraid that my design is awkward.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ctrlarr(5) As PeopleInfo
If Not Session("ctrlarr") Is Nothing Then
ctrlarr = Session("ctrlarr")
If ctrlarr(0).FirstName <> "" Then
Peopleinfo0.FirstName = ctrlarr(0).FirstName
Peopleinfo0.LastName = ctrlarr(0).LastName
Peopleinfo0.SSN = ctrlarr(0).SSN
End If
End If
End Sub
--
Betty
"c676228" wrote:
Hi all,
the data disappearing problem occurs to all my controls even my regualr web
control like asp:textbox, when I click back button in web browser from second
page to first page and then click continue button on the first page to second
page again, all the data entered , even in web server control(not user
controls defined by myself.) all disappear.
What's going on. I thought dealing with .net should be much easier, did I
miss something???
--
Betty
--
Betty

Jan 31 '06 #2
Hi Betty,

As for the data disappearing problem when swtiching page through the
browser's back/forward button, it's the expected behavior because different
pages are displayed in browser through different http requests to server.
When we use back button of browser, it may display the previous page with
input fields filled since the page is retrieved from cache. However, when
go forward again, the page is requested again from serverside, then the
input fields on the page will be the initial state(empty). And for such
scenario I think your current approach that using session state to store
the temp data is reasonable, and the only drawback is that we have to clear
the session data as soon as possible(right after we finish using them) so
as to avoid occupying too much server resource...

BTW, if you feel it possible that we put the wizard/multiple steps like
user interface in single page, you can consider my suggestion on using the
ASP.NET 2.0's wizard control as mentioned in your another thread.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 1 '06 #3
how Yes, Steven. I will consider using that in the next project. I definitely
think it's better way. By the way, how to clear session in asp.net, is it the
same as in asp.
Thank you for your great much. You gave me many good answers to my several
posts.
--
Betty
"Steven Cheng[MSFT]" wrote:
Hi Betty,

As for the data disappearing problem when swtiching page through the
browser's back/forward button, it's the expected behavior because different
pages are displayed in browser through different http requests to server.
When we use back button of browser, it may display the previous page with
input fields filled since the page is retrieved from cache. However, when
go forward again, the page is requested again from serverside, then the
input fields on the page will be the initial state(empty). And for such
scenario I think your current approach that using session state to store
the temp data is reasonable, and the only drawback is that we have to clear
the session data as soon as possible(right after we finish using them) so
as to avoid occupying too much server resource...

BTW, if you feel it possible that we put the wizard/multiple steps like
user interface in single page, you can consider my suggestion on using the
ASP.NET 2.0's wizard control as mentioned in your another thread.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 1 '06 #4
My pleasure Betty :)

For Session State, we have the following pattern to clear values in it:

1. When a certain item in it is no longer needed, we can just clear it by
assign that entry to null , e.g:

Session["key1"] = null;

then, that entry's referenced object will be ready for GC(if there is other
live reference to it).

2. If you want to clear all the referenced objects in the current User's
Session, you can call HttpSessionState.Clear method:

#HttpSessionState.Clear Method
http://msdn.microsoft.com/library/en...websessionstat
ehttpsessionstateclasscleartopic.asp?frame=true

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 2 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by notalent | last post: by
2 posts views Thread by dave | last post: by
11 posts views Thread by ElmoWatson | last post: by
1 post views Thread by Angus Lepper | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.