Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Querystring - persisting viewstate?

Reply
Thread Tools

Querystring - persisting viewstate?

 
 
Chris Ashley
Guest
Posts: n/a
 
      10-12-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
 
      10-12-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) oups.com...
> 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
 
      10-12-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

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 ASP .Net 6 04-06-2006 03:41 PM
Passing QueryString URL as a paremeter in QueryString Adeel Ahmad ASP General 1 03-07-2006 02:05 PM
Persisting password in Server Explorer/Data connections Per Schjetne ASP .Net 0 10-17-2003 11:04 AM
Re: Persisting DDL.SelectedValue or DDL.SelectedItem.Value without Viewstate Marina ASP .Net 0 08-12-2003 07:08 PM
Re: Application variable not persisting Natty Gur ASP .Net 2 07-20-2003 08:27 AM



Advertisments