Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-06-16 : 19:50:11
|
I have an aspx page. I load specific user controls dynamically. I load a user control UC1, if the user clicks a button on UC1, I load an other user control UC2.How can I keep values of variables declared in UC1 so that I can get them when I load UC2. I think there will be a round trip to the server in the meanwhile since the users clicks a button on UC1 before UC2 is loaded.Thanks |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2006-06-16 : 20:13:11
|
I think you have to add the values that you need to persist to viewstate or session in the OnClick event of your button.Michael<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights. |
 |
|
JBelthoff
Posting Yak Master
173 Posts |
Posted - 2006-06-20 : 16:46:19
|
While you certainly can use the Viewstate or session variables to pass the information along, a user control's values should be passed along with the postback handler.Or in other words, if you have coded your UC correctly, it should be passing these values already.JBelthoff• Hosts Station is a Professional Asp Hosting Provider• Position SEO can provide your company with SEO Services at an affordable price› As far as myself... I do this for fun! |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-06-23 : 01:31:23
|
but how about if I load a different user control on the same page and then in a second post back I wanna load the first user control. its variables ll have been lost by then. is that correct. |
 |
|
JBelthoff
Posting Yak Master
173 Posts |
Posted - 2006-06-26 : 10:32:41
|
You load the controls once. Whether you display, or use, each of them on each post back is up to you.The only problem you should have is if you load the control a second time. Then you have lost all of the variables.Load once, use many.... JBelthoff• Hosts Station is a Professional Asp Hosting Provider• Position SEO can provide your company with SEO Services at an affordable price› As far as myself... I do this for fun! |
 |
|
|
|
|