473,769 Members | 6,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading Controls Dynamically

Hi -

I am seeing some performance degradation when I am loading a control
dynamically onto a page with multiple other dynamical controls using
Page.LoadContro l versus dragging and dropping it onto an individual page.

Page1.aspx.cs
UserControl uc = Page.LoadContro l("../UserControls/UserControl1.as cx")

Page2.aspx
<%@ Register TagPrefix="uc1" TagName="UserCo ntrol1"
Src="../UserControls/UserControl1.as cx" %>
<HTML>
<HEAD></HEAD>
<BODY>
<form id="StrategicRe ports" method="post" runat="server">
<uc1:UserContro l1 id="UI1" runat="server"> </uc1:UserControl 1>
</form>
</BODY>
</HTML>

Page2.aspx renders the control much faster than Page1.aspx. Page1.aspx does
do some work in trying to identify which control to load but this still does
not account for the performance hit. Any ideas what is going on here? Is
there some other way to dynamically load the user control, say by adding a
"Reference" in Page1.aspx? Any help will be greatly appreciated.

Thanks in advance.
Kan
Nov 18 '05 #1
1 1423
This shouldn't be a surprise...one is loading the control at runtime, the
other at compile time. It's slower, but it shouldn't be hugely slower (ie,
only noticable when profiling).

Server controls load considerably faster than user controls...but that's
really your only option..

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"kanones" <ka*****@discus sions.microsoft .com> wrote in message
news:FB******** *************** ***********@mic rosoft.com...
Hi -

I am seeing some performance degradation when I am loading a control
dynamically onto a page with multiple other dynamical controls using
Page.LoadContro l versus dragging and dropping it onto an individual page.

Page1.aspx.cs
UserControl uc = Page.LoadContro l("../UserControls/UserControl1.as cx")

Page2.aspx
<%@ Register TagPrefix="uc1" TagName="UserCo ntrol1"
Src="../UserControls/UserControl1.as cx" %>
<HTML>
<HEAD></HEAD>
<BODY>
<form id="StrategicRe ports" method="post" runat="server">
<uc1:UserContro l1 id="UI1" runat="server"> </uc1:UserControl 1>
</form>
</BODY>
</HTML>

Page2.aspx renders the control much faster than Page1.aspx. Page1.aspx does do some work in trying to identify which control to load but this still does not account for the performance hit. Any ideas what is going on here? Is
there some other way to dynamically load the user control, say by adding a
"Reference" in Page1.aspx? Any help will be greatly appreciated.

Thanks in advance.
Kan

Nov 18 '05 #2

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

Similar topics

0
1111
by: Peter Zuber | last post by:
Hi NG We want to load controls dynamically and create them on a WinForm. Doing so, we seem to loose type information. The scenario is as follows: The class MANCombobBox inherits from ComboBox and implements the interface IReportDataSource. This works: Control c = new MANComboBox(); //MANComboBox inherits from ComboBox and implements the interface IReportDataSource
2
2542
by: macca | last post by:
Hi, I am writing a GUI application. It will have a number of user defined controls( I plan to use/create a user defined control that will output alarm states that the user can also select and will open a dialog to give more detailed information) . The number of controls on the main GUI will vary from client site to client site. I would therefore like to populate the dialog with these controls dynamically.
1
1464
by: Sundaresan | last post by:
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
1
1433
by: Jill Graham | last post by:
Hi, I can use following syntax to add user controls directly to my pages : <XYZ:myControl parameter1="value1" parameter2="value2" runat="server" /> The control "myControl" is executed using the supplied parameters parameter1 and parameter2 Now my question : I've found two ways to add controls dynamically to my page :
3
1187
by: supvine | last post by:
Hello, I am developing a page that has several custom web user controls that need to be loaded dynamically. Some of the controls are loaded based on the action (button-click) of a different control in the parent page. Currently what I have to do to make this work is set a session variable to load/unload a particular control and do a Server.Transfer to the page itself from the Button_Click event. Is this a good way of loading controls...
4
1514
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I have a textbox for searching, a listbox to display the searched results, and a big textbox (memo) to display the clicked-results of the listbox item. My question is: should I load the controls with objects, and therefore store everything in...
0
1887
by: yeltsin27 | last post by:
I need some advice on handling dynamically added controls in a GridView. My app takes an uploaded CSV file containing addresses, converts it to a DataTable, databinds the DataTable to a GridView, accepts information via dropdowns embedded in the first row of the GridView about which incoming fields should go to which database fields, and writes the data to the database. The incoming data has an arbitrary number of columns so I create...
2
2136
by: Raymond Du | last post by:
Hi, I need to find a way to place multiple textboxes and other controls dynamically on a web form, I tried to put a placeholder on a form then create and add controls dynamically into the place holder. It is not working, all controls added disappear after the postback. I tried to find a working sample on Internet with no lucks, some samples are able to keep the controls after the postback, but all values entered before the postback...
4
2975
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a while and it seems it's not possible because the row that gets added with each click won't get recreated after a post back. After all the reading it seems that any dynamically created controls must be created in the Init event to be recreated after...
0
10216
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
10049
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
9997
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
8873
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...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
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...
1
3965
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
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.