469,964 Members | 1,581 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

Problem with loading UserControls dynamically.

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

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

Nov 18 '05 #1
1 1301

try to use the override OnInit method and page_load. using those methods
won't harm postback behavior.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Hendrik W. Hansen | last post: by
1 post views Thread by kanones | last post: by
reply views Thread by Phl | last post: by
9 posts views Thread by Anders K. Jacobsen [DK] | last post: by
2 posts views Thread by chandu | last post: by
1 post views Thread by =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.