Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem with loading UserControls dynamically.

Thread Tools

Problem with loading UserControls dynamically.

Posts: n/a
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.

Reply With Quote
Natty Gur
Posts: n/a

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

Natty Gur[MVP]

blog :
Mobile: +972-(0)58-888377

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
V1.1 compilation model in V2.0 - Loading of UserControls across VDirs Anders Borum ASP .Net 1 11-28-2005 11:08 PM
Loading usercontrols, viewstate problem, slighly different from all others "viewstate uc problems" please help... ujjc001 ASP .Net 0 07-27-2005 01:52 PM
dynamically loading usercontrols ( Darrel ASP .Net 3 11-08-2004 05:06 AM
Problem loading usercontrols dynamically with hyperlinks and images Brett ASP .Net 1 09-09-2004 04:52 AM
Loading UserControls dynamically Hendrik W. Hansen ASP .Net 0 10-28-2003 03:08 PM