A
Alexander van Doormalen
I have a situation that user controls are dynamically loaded within a
page. To know which control to 're-add' to the page I saved the control
path in the ViewState. This Control is added using LoadControl in the
Load event handler. This works fine however the user controls which
need to be added need to load their ViewState aswell as the page
itself.
In this situation this isn't gonna work cause the ViewState is loaded
before the Load event fires. Because I need to know which control to
're-add' I saved this in the ViewState. However in the Page Init event
handler you can't access the ViewState cause its not loaded yet and
this is the only place (as far as I know) which lets the added user
control load its ViewState.
Does anybody know some nice way to solve this. I thought of sessions
but this is gonna be messy when having multiply browser windows open to
the same page. Cookies will give you the same result. Maybe using
custom hidden fields but this is in my opinion nasty aswell. Is their
anyway the ViewState can be loaded in the Page Init event handler. Or
accessed/decrypted etc?
page. To know which control to 're-add' to the page I saved the control
path in the ViewState. This Control is added using LoadControl in the
Load event handler. This works fine however the user controls which
need to be added need to load their ViewState aswell as the page
itself.
In this situation this isn't gonna work cause the ViewState is loaded
before the Load event fires. Because I need to know which control to
're-add' I saved this in the ViewState. However in the Page Init event
handler you can't access the ViewState cause its not loaded yet and
this is the only place (as far as I know) which lets the added user
control load its ViewState.
Does anybody know some nice way to solve this. I thought of sessions
but this is gonna be messy when having multiply browser windows open to
the same page. Cookies will give you the same result. Maybe using
custom hidden fields but this is in my opinion nasty aswell. Is their
anyway the ViewState can be loaded in the Page Init event handler. Or
accessed/decrypted etc?