Hello,
I am loading several user controls dynamically in OnInit() like this:
ucListBoxSelect ions ucLocation =
(ucListBoxSelec tions)LoadContr ol("UserControl s/ucListBoxSelect ions.ascx");
ucListBoxSelect ions ucDept =
(ucListBoxSelec tions)LoadContr ol("UserControl s/ucListBoxSelect ions.ascx");
ucListBoxSelect ions ucBusiness =
(ucListBoxSelec tions)LoadContr ol("UserControl s/ucListBoxSelect ions.ascx");
PlaceHolder1.Co ntrols.Add(ucLo cation);
PlaceHolder1.Co ntrols.Add(ucDe pt);
PlaceHolder1.Co ntrols.Add(ucBu siness);
Then, in the Page_Load I thought I should be able to access these Controls
and reload (or assign for the first time) its data through the ViewState
(that has not been lost because it was loaded in OnInit().
Am I doing this correctly because I cannot "find" these Controls in
Page_Load?
Also, each time I click on any one of these User Controls there is a
postback, as expected, but all the listboxes (in each of the user controls)
still seems slow to load. I assume that is because they are reloading. The
idea, I thought, was that it was faster to load these controls in OnInit.
I think I am close, does anyone have some suggestions?
Thank you.
p.s. There are several user controls that get loaded each time. However,
they do not have to be dynamic because they will always appear on the page.
It's just their data in their listboxes will change. Is there a better way
to approach this? 1 2353
Here is a starter article to read: http://msdn2.microsoft.com/en-us/library/ms178472.aspx
This article describes the ASP.NET Page LifeCycle. It describes how
everything is built when you request an asp.net page and in what order.
IIRC, You should be able to access the controls in the Page_Load
method, at this point OnLoad is called and postback data is loaded into
the controls. So you should be able to.
I apologize for the vagueness of the post, its been a little while
since I've played with dynamic controls so my mind is a little fuzzy.
Take a look at that article though, that should point you in the right
direction.
Gummy wrote:
Hello,
I am loading several user controls dynamically in OnInit() like this:
ucListBoxSelect ions ucLocation =
(ucListBoxSelec tions)LoadContr ol("UserControl s/ucListBoxSelect ions.ascx");
ucListBoxSelect ions ucDept =
(ucListBoxSelec tions)LoadContr ol("UserControl s/ucListBoxSelect ions.ascx");
ucListBoxSelect ions ucBusiness =
(ucListBoxSelec tions)LoadContr ol("UserControl s/ucListBoxSelect ions.ascx");
PlaceHolder1.Co ntrols.Add(ucLo cation);
PlaceHolder1.Co ntrols.Add(ucDe pt);
PlaceHolder1.Co ntrols.Add(ucBu siness);
Then, in the Page_Load I thought I should be able to access these Controls
and reload (or assign for the first time) its data through the ViewState
(that has not been lost because it was loaded in OnInit().
Am I doing this correctly because I cannot "find" these Controls in
Page_Load?
Also, each time I click on any one of these User Controls there is a
postback, as expected, but all the listboxes (in each of the user controls)
still seems slow to load. I assume that is because they are reloading. The
idea, I thought, was that it was faster to load these controls in OnInit.
I think I am close, does anyone have some suggestions?
Thank you.
p.s. There are several user controls that get loaded each time. However,
they do not have to be dynamic because they will always appear on the page.
It's just their data in their listboxes will change. Is there a better way
to approach this?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tom Wisnowski |
last post by:
Hello all,
Here is a simple example of what I'm doing...
Create a ASPX page
Add a PlaceHolder(plch) and a Button(btn) to the page.
In the code behind on Page_load add the following...
TextBox txt = new TextBox();
if(!IsPostBack)
|
by: Chuck Ritzke |
last post by:
Hi,
I've searched the newsgroup and other sources to understand how to handle
runtime controls and see I'm not the only one who's confused, but I'm still
not quite sure of the best way to handle from all the various
explanations/answers. I'm attempting the typical scenario...
I create a variable number of controls at runtime based on parameters from a
database.
|
by: Perecli Manole |
last post by:
I have a form that dynamicaly loads user controls based on user
postbacks. Everything works well except that the framework seems to
want to match the viewstate data from my previous control to the new
control on post back even through the IDs are all different. Is
there a way to selectively clear the viewstate of a control before
the framework does the match and applies the viewstate? Disabling
the viewstate is not an option since I need...
|
by: Stu |
last post by:
Hi,
I am creating a control in a PlaceHolder like so:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDelete.Click
Dim ctrl As AcceptOrCancel =
CType(Page.LoadControl("controls/AcceptOrCancel.ascx"), AcceptOrCancel)
PlaceHolder1.Controls.Add(ctrl)
|
by: novus |
last post by:
Hi,
In ASP.net 2.0 I make a control which add the same controls dynamically. In
the oninit event I add the controls to the controls collection. After that
the loadviewstate event fills in the information on postbacks. The control
can add and delete controls that is why on the postback I don't know how many
controls there are.
At the moment I am able to get the controls rendering but I have problems to
save the count of the dynamic...
| |
by: npverni |
last post by:
I have a fairly complex form that needs to load and maintain the state
of several different dynamic user controls. Here is the workflow:
1) A series of editable user controls (each containing basic web form
elements: textboxs, buttons, etc) are loaded from an xml file.
2) The user can either edit these user controls or select from a list
of user controls to add to teh page.
3) The user clicks "save" to save the content of all of...
|
by: Andrew Robinson |
last post by:
I have a <asp:table> control with a large number of dynamically created
LinkButtons. I am using the command event, command name and command argument
values in my LinkButtons to trigger actions after the post back. The table
is dynamically generated based on a key field that is stored in ViewState.
This key field is updated by several other controls on the same page.
I am struggling with the pattern of when to create the table. I can't...
|
by: MaryamSh |
last post by:
Create Dynamic Dropdownlist Controls and related event
--------------------------------------------------------------------------------
Hi,
I am creating a Dynamic Search in my application.
I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove)
By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on.
and by...
|
by: Hans Kesting |
last post by:
Hi,
Is there good information about the asp.net page lifecycle in
combination with dynamically loaded controls? Or on "how to build
dynamic controls"? I keep hitting problems where values are not
available at the moment I need them.
Current problem:
In a dynamically loaded ascx there is a dropdown. Based on the selected
value (reloading an existing value or responding to a
|
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: 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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 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: 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...
| | |