473,395 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to stop a user control from loading

I added a user control to a webform in Asp.net 2.0. I am also adding
several other user controls to this webform. Now I am trying to find
a way to stop the user controls from loading up when I call the
webform. I could possibly have 10 user controls in this page and I
would not want all of them to load up. I would like to control which
user control loads up. I have tried placing each user control in a
separate placeholder and then disabling the place holder for the
controls I don't need on the page_load of the webform. But, I notice
the control still loads because I placed a break point in the
page_load of the user control and it is still being hit. I even tried
using the following code:

Me.Controls.Remove(UserControl1)

In the page_load of the main webform but the controls still loads!
How can I stop the user control from loading up at all? I hope this
is not a limitation of Asp.net 2.0 in that the user control HAS to
load once it is added to a webform...

Thanks Before Hand,
Adiel

Aug 22 '07 #1
2 7149
<ad*****@hotmail.comwrote in message
news:11**********************@r29g2000hsg.googlegr oups.com...
>I added a user control to a webform in Asp.net 2.0. I am also adding
several other user controls to this webform. Now I am trying to find
a way to stop the user controls from loading up when I call the
webform. I could possibly have 10 user controls in this page and I
would not want all of them to load up. I would like to control which
user control loads up. I have tried placing each user control in a
separate placeholder and then disabling the place holder for the
controls I don't need on the page_load of the webform. But, I notice
the control still loads because I placed a break point in the
page_load of the user control and it is still being hit. I even tried
using the following code:

Me.Controls.Remove(UserControl1)

In the page_load of the main webform but the controls still loads!
How can I stop the user control from loading up at all? I hope this
is not a limitation of Asp.net 2.0 in that the user control HAS to
load once it is added to a webform...
It's because the controls are already loaded before the execution of
Page_Load in the page.

Why exactly do you want to stop them from loading?
Is making them invisible not enough?

If you really want to stop them from loading, you should go for the reverse
approach:
remove all of the controls from the webform in design, and add them
programmatically in Page_Load.

Riki
Aug 22 '07 #2
Hello Riki:

Why exactly do you want to stop them from loading?
I want to stop them from loading because each user control is doing
additional loading of data, etc. Even when it is not needed

Is making them invisible not enough?
Making them invisible will still load the control. You can see this
when you debug, it still loads the control.

If you really want to stop them from loading, you should go for the reverse
approach:
remove all of the controls from the webform in design, and add them
programmatically in Page_Load.
Thank you, I guess if there is no way to "unload" them, I will have to
use your approach: to load them
programmatically and remove them from the webform design. I hope they
will add an "unload" feature
for vs2008.

Thanks,
Adiel

Aug 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Efkas | last post by:
My application have some level : 1. MyButton class with Label inheritance 2. MyComponent as User Control loading and positionning some of MyButtons 3. MyApp loading and positionning MyComponent ...
0
by: Jo Inferis | last post by:
Disclaimer : I'm fairly new to .NET (about 4 weeks and counting now...) I have a page which contains multiple user controls, some of which it has access to the methods of (by making the controls...
4
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
2
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
0
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
3
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
1
by: Salvador | last post by:
Hi, I don't know why but I have a page that has one usercontrol (added dynamically on the servcer using LoadControl). If I execute the page and puts a breakpoint on Page_Load of the usercontrol...
0
by: Joe | last post by:
I've a web form that inherits from a BasePage. There is a user control on the web form. Does anyone thinks it's a problem if I've my BasePage loading a user control and my web form loading a...
5
by: Norsoft | last post by:
I have a .Net 1.1 application which is downloaded into an aspx page. It is a dll which inherits from System.Windows.Forms.UserControl. It works fine on a PC with only the 1.1 Framework. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.