Hi all,
I'm having a little problem understanding the concepts of dynamically
loading/unloading user conrols:
1. If I have a couple of usercontrols embedded within a few tables cells on
my page, setting the usercontrol's visible to false still fires the
Page_Load event. Isn't this unnecessary overhead when it doesn't even show
in my page.
2. For my usercontrols to be able to see one another's methods, do I have to
define the usercontrol within the code-behind of each usercontrol I wish to
reference?
3. To dynamically load/unload usercontrols, must I register them at least
within my page at design-time? This seems 'un-dynamic' to me.
4. What method do I use to run code the first time my user control is
dynamically loaded. I don't want to run the code again after that unless it
is removed then re-loaded again.
There clearly is much for me to learn about usercontrols. If the above four
questions could please be answered and perhaps a pointer to some good online
reading material, I really would appreciate this!
Thanks.
Regards
John. 4 6955
1. Loading a control and making it not visible are 2 different things.
Invisible controls will not be rendered to the page - but they are still
created, and their page_load will still fire.
2. You should define public methods to allow this. You will also need to
have a way for one control to get a reference to the instance of the other
control.
3. To dynamically load controls, you do not need to register anything with
the page. You can just call the LoadControl method of the page, and then add
the newly created usercontrol to your page.
"John" <a@b.com> wrote in message
news:eu******** ******@TK2MSFTN GP11.phx.gbl... Hi all,
I'm having a little problem understanding the concepts of dynamically loading/unloading user conrols:
1. If I have a couple of usercontrols embedded within a few tables cells
on my page, setting the usercontrol's visible to false still fires the Page_Load event. Isn't this unnecessary overhead when it doesn't even show in my page.
2. For my usercontrols to be able to see one another's methods, do I have
to define the usercontrol within the code-behind of each usercontrol I wish
to reference?
3. To dynamically load/unload usercontrols, must I register them at least within my page at design-time? This seems 'un-dynamic' to me.
4. What method do I use to run code the first time my user control is dynamically loaded. I don't want to run the code again after that unless
it is removed then re-loaded again.
There clearly is much for me to learn about usercontrols. If the above
four questions could please be answered and perhaps a pointer to some good
online reading material, I really would appreciate this!
Thanks.
Regards John.
Hi John,
Here is the answer to your queries.
1. If you are using the register directive to load the
userconoreol (I mean design time loading), Then page load
of the suer control will run even if the vicible property
= false. This is to initialize the control.
2&3. If you want to dynamically load the user control from
code behind please use the loadcontrol( ) method with
refernce to *.ascx file. No need to use both register &
loadcontrol simultaniously.
4. If you enbael the page caching for your usercontrol (I
mean fragment caching) then it wont take much time to load
the usercontrol next time.
The following links will be usefull. http://samples.gotdotnet.com/quickst...us/doc/webpage
lets.aspx http://www.codeproject.com/aspnet/as...ercontrol2.asp http://www.dotnetjohn.com/articles/articleid52.aspx
regards
Sreejumon[MVP]
DOTNET makes IT happen -----Original Message----- Hi all,
I'm having a little problem understanding the concepts of
dynamicallyloading/unloading user conrols:
1. If I have a couple of usercontrols embedded within a
few tables cells onmy page, setting the usercontrol's visible to false still
fires thePage_Load event. Isn't this unnecessary overhead when it
doesn't even showin my page.
2. For my usercontrols to be able to see one another's
methods, do I have todefine the usercontrol within the code-behind of each
usercontrol I wish toreference?
3. To dynamically load/unload usercontrols, must I
register them at leastwithin my page at design-time? This seems 'un-dynamic' to
me. 4. What method do I use to run code the first time my
user control isdynamically loaded. I don't want to run the code again
after that unless itis removed then re-loaded again.
There clearly is much for me to learn about usercontrols.
If the above fourquestions could please be answered and perhaps a pointer
to some good onlinereading material, I really would appreciate this!
Thanks.
Regards John.
.
John
Have you gotten worked out your solution to loading your controls
dynamically, it sounds like you are having close to the same problrems I am
having.
Kurt
"John" <a@b.com> wrote in message
news:eu******** ******@TK2MSFTN GP11.phx.gbl... Hi all,
I'm having a little problem understanding the concepts of dynamically loading/unloading user conrols:
1. If I have a couple of usercontrols embedded within a few tables cells
on my page, setting the usercontrol's visible to false still fires the Page_Load event. Isn't this unnecessary overhead when it doesn't even show in my page.
2. For my usercontrols to be able to see one another's methods, do I have
to define the usercontrol within the code-behind of each usercontrol I wish
to reference?
3. To dynamically load/unload usercontrols, must I register them at least within my page at design-time? This seems 'un-dynamic' to me.
4. What method do I use to run code the first time my user control is dynamically loaded. I don't want to run the code again after that unless
it is removed then re-loaded again.
There clearly is much for me to learn about usercontrols. If the above
four questions could please be answered and perhaps a pointer to some good
online reading material, I really would appreciate this!
Thanks.
Regards John.
Hi Kurt,
I have finally got it working, although now I'm treading water in another
area (also user control related). If there is anything in particular I could
help with, let me know.
Regards
John. fi************* ***@hotmail.com
"Kurt" <k_******@larim ore.net> wrote in message
news:ed******** *****@tk2msftng p13.phx.gbl... John
Have you gotten worked out your solution to loading your controls dynamically, it sounds like you are having close to the same problrems I
am having.
Kurt
"John" <a@b.com> wrote in message news:eu******** ******@TK2MSFTN GP11.phx.gbl... Hi all,
I'm having a little problem understanding the concepts of dynamically loading/unloading user conrols:
1. If I have a couple of usercontrols embedded within a few tables cells on my page, setting the usercontrol's visible to false still fires the Page_Load event. Isn't this unnecessary overhead when it doesn't even
show in my page.
2. For my usercontrols to be able to see one another's methods, do I
have to define the usercontrol within the code-behind of each usercontrol I wish to reference?
3. To dynamically load/unload usercontrols, must I register them at
least within my page at design-time? This seems 'un-dynamic' to me.
4. What method do I use to run code the first time my user control is dynamically loaded. I don't want to run the code again after that unless it is removed then re-loaded again.
There clearly is much for me to learn about usercontrols. If the above four questions could please be answered and perhaps a pointer to some good online reading material, I really would appreciate this!
Thanks.
Regards John.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sonic_soul |
last post by:
basically im using a usercontrol to load other user controls, but
cannot read their user input on postback.
im using this LoadControls user control in order to load 4
different controls onto my page into panels.
<my:control>
<asp:Panel id="ECertificatePanel" runat="server" />
<asp:Panel id="BillingAddressPanel" runat="server" />
...
|
by: Nick Stansbury |
last post by:
Hi,
Apologies for what are probably pretty basic questions - and my convoluted
explanation. Built some simple user controls, that represent the UI side for
a whole bunch of Event objects (in the form of real everyday events likes
conferences, seminars etc.). So I have the following:
Class EventBase
EventTitle as string
etc.
End Class
|
by: Johnny Fugazzi |
last post by:
Good morning,
Background: I am working on a web that will display information about
companies and contacts. I would like to have a details page that displays
some basic details about the record that has been selected (works), and then
have a table with a series of "tabs" that load additional details. I am
using this approach to cut down on the number of pages needed.
The "tabs" are a series of linkbuttons that clear a panel, and...
|
by: Jay Douglas |
last post by:
I have a set of pages that inherit from a base class in the App_Code folder.
The class looks something like:
public class MyBaseClass : System.Web.UI.Page
In various stages of the life cycle I need to add user controls to the page
control container. i.e:
protected override void OnInit(EventArgs e)
{
|
by: Alixx Skevington |
last post by:
I want to be able to have a page that has several controls on on it, but I
want the page to load first of all and display a loading image on each
control and then I want to then display teh controls as the data has bound
to each control as some of the data I need to load is very big and takes
some time.
I have found some code that creates a Javascript that handles this, but it
only works at page level.
I have looked at the ATLAS...
| |
by: nemesis.saurabh |
last post by:
hi,
Can we dynamically load a user control in the web form.
problem i am facing is i have 2 user controls: uc1 and uc2.
when my page is loading the functions and variables in the uc1 is
conflicting with uc2.
if possible can we have this scenario:
i have both the user controls in my web form. if i want to load uc1, i
can disable uc2...possible both ways.
|
by: Bob Rock |
last post by:
Hello,
I'm new to ASP.NET and I've been looking into the topic of dynamically
loading (typically accomplished with a LoadControl followed by a
MyControl.Controls.Add()) both user controls and asp.net web controls. I
searched for articles on the internet and in the end I must say that I'm
confused.
I read about issues related to:
a.. events not firing
|
by: Rick Mavrovik |
last post by:
Hi,
I am trying to generate a number of Web User Controls (WUC) based on user
input.
This WUC has got 2 drop down controls in it. The WUC works fine when created
in the usual manner but when I try to create it dynamically a null reference
exception is thrown when trying to refering any of the drop down.
UCUserToDeviceInBulk ucTemp = new UCUserToDeviceInBulk();
ucTemp.Visible = true;
|
by: Christian Resma Helle |
last post by:
Hey guys,
I'm working on an AJAX Enabled ASP.NET Web application. I have a TreeView
web control and an PlaceHolder web control. My PlaceHolder is inside an
UpdatePanel and AsyncPostBacks are triggered by the SelectedNodeChanged
event of the TreeView. I dynamically load user controls into my PlaceHolder
depending on what node the user clicks on the TreeView. The user control is
loaded into the page and is displayed to the user.
These...
|
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...
|
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...
| |
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...
|
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,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |