473,387 Members | 1,891 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,387 software developers and data experts.

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.LoadControl versus dragging and dropping it onto an individual page.

Page1.aspx.cs
UserControl uc = Page.LoadControl("../UserControls/UserControl1.ascx")

Page2.aspx
<%@ Register TagPrefix="uc1" TagName="UserControl1"
Src="../UserControls/UserControl1.ascx" %>
<HTML>
<HEAD></HEAD>
<BODY>
<form id="StrategicReports" method="post" runat="server">
<uc1:UserControl1 id="UI1" runat="server"></uc1:UserControl1>
</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 1408
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*****@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.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.LoadControl versus dragging and dropping it onto an individual page.

Page1.aspx.cs
UserControl uc = Page.LoadControl("../UserControls/UserControl1.ascx")

Page2.aspx
<%@ Register TagPrefix="uc1" TagName="UserControl1"
Src="../UserControls/UserControl1.ascx" %>
<HTML>
<HEAD></HEAD>
<BODY>
<form id="StrategicReports" method="post" runat="server">
<uc1:UserControl1 id="UI1" runat="server"></uc1:UserControl1>
</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
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...
2
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...
1
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...
1
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...
3
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...
4
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...
0
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...
2
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...
4
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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...

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.