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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I pass variables during webpage reload? 3

Status
Not open for further replies.

jw970170

Programmer
Aug 8, 2005
38
0
0
Hello everyone,

I was just wondering if there is some way to pass a variable between reloads of a webpage. I thought of one way to do it would be to have invisible text boxes and then just change the value within them. An alternative could be to add the variable to the URL but then it is visible by everyone.

Is there a better way with visual studio .net?

thanks
 
It would be better to store the information in a database. Hidden fields can be injected with variables you don't want. Or if its in a form then do a postback like jbenson said.

Jason

Site San Diego www.sitesd.com

 
If the reloads are the result of a postback, you can use ViewState. It works out to being about the same as a hidden form field, except that it can be encrypted and is much easier to access in code. If your are not posting back, you must use querystring, session, datbase, etc.
 
ok, these are good ideas. I had forgotten about the hidden fields.

The database idea seems good for some situations. In my case, there would be too much writing back and forth to the database on each screen load and with all the other database action that is already happening, I don't think it would quite work out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top