J
John
Hi all,
This really is quite an urgent matter.
I have a page with multiple, dynamically-loaded user controls and when a
user clicks on a button, the whole form is submitted. Now at this stage I
know I need to call a function that will save data but I'm not sure exactly
when to call this function.
I've tried two ways and both seem to have 'gotcha's':
1. In the Page_Load event of the PAGE, I call LoadControl to load the user
control (I need to do this to restore viewstate)
2. Immediately after the LoadControl call, I call myusercontrol.Save() but
the viewstate has not been restored since the Page_Load event of the user
control hasn't fired.
so I then tried :
1. In the Page_Load event of the PAGE, I call LoadControl to load the user
control (I need to do this to restore viewstate)
2. Immediately after the LoadControl call, I populate a session variable to
use in the Page_Load event of my user control.
3. The Page_Load event of my user control fires (because the Page_Load event
of my PAGE ended normally)
4. Right at the end of the Page_Load event of my user control, I call the
Save method contained within but during the save, I don't have access to the
controls on my form (agaion, a viewstate problem).
Exactly where am I supposed to call the public Save method of my user
control?
I hope I've explained clearly as this needs a good, proper solution asap.
Thankyou!
Regards
John.
This really is quite an urgent matter.
I have a page with multiple, dynamically-loaded user controls and when a
user clicks on a button, the whole form is submitted. Now at this stage I
know I need to call a function that will save data but I'm not sure exactly
when to call this function.
I've tried two ways and both seem to have 'gotcha's':
1. In the Page_Load event of the PAGE, I call LoadControl to load the user
control (I need to do this to restore viewstate)
2. Immediately after the LoadControl call, I call myusercontrol.Save() but
the viewstate has not been restored since the Page_Load event of the user
control hasn't fired.
so I then tried :
1. In the Page_Load event of the PAGE, I call LoadControl to load the user
control (I need to do this to restore viewstate)
2. Immediately after the LoadControl call, I populate a session variable to
use in the Page_Load event of my user control.
3. The Page_Load event of my user control fires (because the Page_Load event
of my PAGE ended normally)
4. Right at the end of the Page_Load event of my user control, I call the
Save method contained within but during the save, I don't have access to the
controls on my form (agaion, a viewstate problem).
Exactly where am I supposed to call the public Save method of my user
control?
I hope I've explained clearly as this needs a good, proper solution asap.
Thankyou!
Regards
John.