Problem with loading UserControls dynamically.

S

Sundaresan

I've a form where I load two user controls dynamically.

User Control-1 has a no.of dropdowns and based on the
selection I typically
populate a datagrid in the user control-2,

Also the I could be loading a different usercontrol-2
based on the selections in usercontrol-1.

Also I thought of passing the selection values through
public properties of the usercontrols without
resorting to querystrings or session variables.

So I've decided to load the UserControl-1 in Page_Load and
Load UserControl-2 in Page_Prerender
So that the postback on usercontrol-1 is processed and the
properties of usercontrol-2 are set
properly before it loads.

This works just fine, until I've a requirement where I
need to post back from the datagrid in user_control2.
Those events just won't fire ( probably because I'm always
loading the usercontrol-2 in PreRender ).

On the other hand, If I try to load both user controls in
page load, UserControl-2 would not know any thing
about the usercontrol-1's server controls Current
selection.

Can some one straighten out this design problem for me ?
Appreciate your help.

-Sundar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top