473,657 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
selection.

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

-Sundar
Nov 18 '05 #1
1 1456
Hi,

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1006
by: Hendrik W. Hansen | last post by:
I'm working on a WebForm, that through some tabs can load and contain a number of different "plugin" UserControls, all derived from the same "plugin" super class - a bit like the IBuySpy portal. An XML file defines which plugins are available and should be listed in my tab control. When the user clicks on as tab, the page should load the corresponding UserControl into a panel via Page.LoadControl and Controls.Add. This works fine, but...
1
1477
by: Brett | last post by:
Hi, Here's a strange one: I have built a single page model for a website, that uses 3 panel controls which load usercontrols dynamically, based on the querystring PageMode parameter that you pass. For instance, if you pass PageMode=home, it will show the home page view, and so on. On the left panel I display a menu usercontrol that is a table consisting of a list of hyperlinks (a href, not link buttons) and some
1
1419
by: kanones | last post by:
Hi - I am seeing some performance degradation when I am loading a control dynamically onto a page with multiple other dynamical controls using Page.LoadControl versus dragging and dropping it onto an individual page. Page1.aspx.cs UserControl uc = Page.LoadControl("../UserControls/UserControl1.ascx") Page2.aspx
0
1508
by: Phl | last post by:
Hi, I am trying to create an webform which loads usercontrols dyanamically. I know exactly what to load for some of these controls but for some, I dont want to load it until the user has press a button. The controls which I know I will need at page init gets their viewstate contents back properly per postback. However I am having a lot of troubles with keeping the contents of usercontrols which are
9
2445
by: Anders K. Jacobsen [DK] | last post by:
Hi I have this that adds some usercontrol (UCTodays.ascx) to a placeholder foreach(A a in B){ UCTodays ucline = (UCTodays )LoadControl("UCTodays.ascx"); ucline.Initializecontrol(line,alternate); Placeholder1.Controls.Add(ucline); }
3
1578
by: navyliu | last post by:
I have raised a discussion about assembly unloading.But we can't get a final solution. Since we cannot unlaod a assembly,Is there any reference about this indicate that this problem won't make smartclient use up memory? Best regard navyliu
2
1213
by: chandu | last post by:
Hai all, i am developing an applciation which loads all configuation plugins in MainForm when clicks on corresponding plugin button. let me explain : SomePlugin is a class library projects which contains 3 UserControls.Every user control has its own functionality like save,clear,edit....etc.
5
8575
by: marfi95 | last post by:
I have a form that has a left and right panel. In the left panel is a treeview. The right panel I want to change dynamically based on the type of node selected. What I'm doing is loading the treeview nodes through an XML file. As part of each node in the XML, I'm using an attribute that indicates the name of a sub form to load. As part of all these little child forms, the main control is a panel, which I then assign its parent to the...
1
1177
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
(I've been away from web app programming for a while. Most of my experience has been in 1.1. Now I'm using vb/Dot Net 2.0) Please explain a couple of things. First, I have a simple-minded usercontrol defined. No real code so far. Just a bunch of text boxes on a panel. I want to dynamically load one or more instances of the usercontrol onto the screen. Why is it that the command 'Me.Form.Controls.Add' will work with stock
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.