Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Postback and Querystrings...

Status
Not open for further replies.

Interwizard

Programmer
Nov 9, 2001
18
US
Hi all!

In ASP.Net,, when using a webform that does a postback, is there a way to modify the postback to include querystrings originally passed into the page?

Currently, I have web forms that allow for QueryStrings to be passed to alter results. Those pages allow paging functions, etc that are handled through a postback. On the postback the querystrings are lost. Of course, I could drop the values into a session variable, cookie or hidden textbox but these do not seem to be clean solutions. Has anyone else encountered a way to customize the postback in this manner?

Cheers,
Bill Dodd
 
You don't have complete control in this arena.

However, you can place querystring values into ViewState, which will be persisted over postback, so

if(!IsPostBack)
//grab values from querystring and stuff into ViewState
else
//grab values from ViewState

-paul

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
Great tip! I had no idea you could manually store things in ViewState. That's sweet. Thanks a ton for the tip!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top