Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2005

Tip: Looking for answers? Try searching our database.

View State - Query Strings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim McGivney - 23 Oct 2005 20:34 GMT
I have an aspx page, on this page I have a number of Labels.
If I response.Redirect("anotherPage.aspx") and then return by
Response.Redirect("InitialPage.aspx") without a query string,
the content of the Labels is maintained by View State.

If I return with a query string
Response.Redirect("InitialPage.aspx?Pram1=value1);
the contents of the Labels are not maintained.
Any suggestions as to how to maintain the contents of the Labels when using
a query string would be appreciated.
Sample code would be helpful.
Thanks in advance for your help,

Jim
S.M. Altaf [MVP] - 23 Oct 2005 21:32 GMT
Jim,

The behavior that you're observing has more to do with caching of the page, rather than viewstate.  When you do Response.Redirect("InitialPage.aspx") and go back to the initial page, you are looking at the copy of that page from your machine's cache.  When you go back to InitialPage.aspx with a querystring parameter, there is no page corresponding to that URL in your cache, and so your values are not retrieved.  

What you need is a mechanism that stores the values in the labels.  If the values in the labels are part of a multi-page processing routine, then you should store them in the session object, perhaps as part of an object that gets passed from page to page.  And then read the value from the session object when the page loads.

HTH
Altaf [MVP-VB]

--------------------------------------------------------------------------------

All that glitters has a high refractive index.
www.mendhak.com

 I have an aspx page, on this page I have a number of Labels.
 If I response.Redirect("anotherPage.aspx") and then return by
 Response.Redirect("InitialPage.aspx") without a query string,
 the content of the Labels is maintained by View State.

 If I return with a query string
 Response.Redirect("InitialPage.aspx?Pram1=value1);
 the contents of the Labels are not maintained.
 Any suggestions as to how to maintain the contents of the Labels when using
 a query string would be appreciated.
 Sample code would be helpful.
 Thanks in advance for your help,

 Jim

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.