By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Re-loading a UserControl after PostBack

P: n/a
jon
I'm trying to establish how to replace a usercontrol that has already
been loaded (using LoadControl in the Page.Load event) with a
different UserControl following a PostBack. Tying to call
LoadControl(<newControlName>) after the Page.Load routine has finished
does not appear to work. The only way I can think of doing this is to
call Server.Transfer or Request.Redirect to start a new instance of
the form but this means I loose ViewState for the existing form which
I want to retain.

I need a means of re-firing the Page.Load routine after it has occured
without user ineraction.

Any thoughts greatly appreciated.
jon
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
KMA
Could you load the corresponding user control based upon the value of
Page.IsPostback in the Page.Load?

"jon" <jo*@consultix.co.uk> wrote in message
news:17**************************@posting.google.c om...
I'm trying to establish how to replace a usercontrol that has already
been loaded (using LoadControl in the Page.Load event) with a
different UserControl following a PostBack. Tying to call
LoadControl(<newControlName>) after the Page.Load routine has finished
does not appear to work. The only way I can think of doing this is to
call Server.Transfer or Request.Redirect to start a new instance of
the form but this means I loose ViewState for the existing form which
I want to retain.

I need a means of re-firing the Page.Load routine after it has occured
without user ineraction.

Any thoughts greatly appreciated.
jon

Nov 19 '05 #2

P: n/a
The Page_Load event is reaided upon every request. This should be an ok location
to recreate any server side controls that were dynamically added from previous
requests. I posted a sample a while ago:

http://groups-beta.google.com/group/...717a97bd32c450

It doesn't use User Controls, but it should work fine.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I'm trying to establish how to replace a usercontrol that has already
been loaded (using LoadControl in the Page.Load event) with a
different UserControl following a PostBack. Tying to call
LoadControl(<newControlName>) after the Page.Load routine has finished
does not appear to work. The only way I can think of doing this is to
call Server.Transfer or Request.Redirect to start a new instance of
the form but this means I loose ViewState for the existing form which
I want to retain.

I need a means of re-firing the Page.Load routine after it has occured
without user ineraction.

Any thoughts greatly appreciated.

jon


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.