PC Review


Reply
Thread Tools Rate Thread

Querystring - persisting viewstate?

 
 
Chris Ashley
Guest
Posts: n/a
 
      12th Oct 2005
My app seems to lose its viewstate completely when I modify the
querystring. Anything I can do about this?

Cheers,

Chris

 
Reply With Quote
 
 
 
 
Grant Merwitz
Guest
Posts: n/a
 
      12th Oct 2005
Yes, when you modify the querystring you are infact loading a new instance
of the page, and the current viewstate no longer exists.
Viewstate only exists during postback, and will not be available when the
page loads as new again.

Why are you modifying the querystring, are you trying to remember values?
What are you trying to viewstate, a datagrid, or some values to remember?

I imagine you are trying to remember variable values while viewstating your
data (like datagrids).
So, what you can do instead of changing the querystring, is session or
viewstate the variables you are trying to remember.

so if you have a string variable called StrVar, you can remember it like
this.

string StrVar = <some string value>;

to save it:
ViewState["StrVar"] = StrVar;
or
Session["StrVar"] = StrVar;

to retrieve it
StrVar = (string)ViewState["StrVar"];
or
StrVar = (string)Session["StrVar"];

HTH


"Chris Ashley" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> My app seems to lose its viewstate completely when I modify the
> querystring. Anything I can do about this?
>
> Cheers,
>
> Chris
>



 
Reply With Quote
 
 
 
 
Chris Ashley
Guest
Posts: n/a
 
      12th Oct 2005
Hi Grant,

Thanks for that. Basically, I have developed a simple custom server
control for 'Wizard style' panel navigation which consists of
WizardStepper and custom nested control 'Tab'. I'm implementing the
links just as standard <a href="blah.aspx?page=1">. Just curious if
this is bad practice? I guess I should be using LinkButton controls
which would then do a proper postback, but obviously I can't do
<asp:LinkButton> in the render method of my custom control.. any better
way?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get value of QueryString inside QueryString Mehdi Microsoft ASP .NET 6 6th Apr 2006 04:41 PM
XPE SP1 Language Settings Not Persisting =?Utf-8?B?VGlt?= Windows XP Embedded 0 16th Mar 2005 11:29 PM
Fix for IE 6 process persisting... urodoc@charter.net Windows XP Internet Explorer 1 29th May 2004 03:09 PM
Persisting msmsmg.exe Manny Windows XP General 1 27th Nov 2003 12:17 AM
Persisting Offline Folders Steve Windows XP Work Remotely 2 8th Nov 2003 09:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:36 PM.