473,692 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Controls vs. Panels

I'm trying to determine if we want to use panels or user controls for our
pages. Our primary concern is performance, page loading and posting speed.

To illustrate my question, lets use the Customer Orders scenario:

Problem:
User needs to view orders and and edit, add, save on one page called
Orders.aspx. To begin with the page contains a grid with basic information
about an order. The user can click a row to edit or click an "Add" button to
add a new order.

When the user clicks edit or add some controls appear below the grid
allowing them to input data, and then save.

User Control Proposal:
We have the Orders.aspx page and two user controls. The user control with
the grid is called ucOrders.ascx and the user control allowing user input is
called ucChangeOrders. ascx.

The two user controls are on the page during design time, therefore they are
not loaded on the fly during runtime.

When the user clicks the edit button on the ucOrders.ascx control it raises
an event that the Orders.aspx page listens for and then passes the order id
to the ucChangeOrders. ascx page that populates its child controls with the
current data the user can change. When the user clicks save on the
ucChangeOrders. ascx control it raises an event that the Orders.aspx page
listens for to know a save has been done and react to it appropriately.

From a design perspective this approach allows the user controls to be
self-contained with the parent page acting as the controler. It is easier to
follow, the page is not bulky and easier to maintain. However, we fear a
performance hit for doing this will not justify doing it this way when
compared to using panels.

Panels Proposal:
The panels approach is very similar to the User Control approach. The
difference being that the panels are on one page rather than being broken out
to separate files. Of course now you have to maintain panel visibility and
such for the panel that allows input below the grid.

Which is faster? And why? And is there any documentation to back up your
answer?

--
-Demetri
Dec 19 '05 #1
1 2240
Hi Demitri,
Which is faster? And why? And is there any documentation to back up your
answer?
It's not a matter of which is faster. User Controls are compiled when used,
just like Pages. You're not going to see much difference, if any, in
performance.

What you really need to ask yourself is, which methodology is going to work
better for you? The nice thing about Controls, including User Controls, is
that, when designed correctly, they contain all of their own UI logic, and
encapsulate not only their child Controls but functionality as well. In
addition, if you ever need to re-use them, they are already pre-packaged for
reusability.

On the other hand, if there are not many Controls in these User Controls,
you may just elect to use Panels with Controls on them. It's really a matter
of good design.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Demetri" <De*****@discus sions.microsoft .com> wrote in message
news:75******** *************** ***********@mic rosoft.com... I'm trying to determine if we want to use panels or user controls for our
pages. Our primary concern is performance, page loading and posting speed.

To illustrate my question, lets use the Customer Orders scenario:

Problem:
User needs to view orders and and edit, add, save on one page called
Orders.aspx. To begin with the page contains a grid with basic information
about an order. The user can click a row to edit or click an "Add" button
to
add a new order.

When the user clicks edit or add some controls appear below the grid
allowing them to input data, and then save.

User Control Proposal:
We have the Orders.aspx page and two user controls. The user control with
the grid is called ucOrders.ascx and the user control allowing user input
is
called ucChangeOrders. ascx.

The two user controls are on the page during design time, therefore they
are
not loaded on the fly during runtime.

When the user clicks the edit button on the ucOrders.ascx control it
raises
an event that the Orders.aspx page listens for and then passes the order
id
to the ucChangeOrders. ascx page that populates its child controls with the
current data the user can change. When the user clicks save on the
ucChangeOrders. ascx control it raises an event that the Orders.aspx page
listens for to know a save has been done and react to it appropriately.

From a design perspective this approach allows the user controls to be
self-contained with the parent page acting as the controler. It is easier
to
follow, the page is not bulky and easier to maintain. However, we fear a
performance hit for doing this will not justify doing it this way when
compared to using panels.

Panels Proposal:
The panels approach is very similar to the User Control approach. The
difference being that the panels are on one page rather than being broken
out
to separate files. Of course now you have to maintain panel visibility and
such for the panel that allows input below the grid.

Which is faster? And why? And is there any documentation to back up your
answer?

--
-Demetri

Dec 19 '05 #2

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

Similar topics

2
7919
by: conset23 | last post by:
Hello. I'm working with WinForm. It has 30 same user control, each with 4 buttons, 3 labels, 3 textboxes, 2 picture boxes and uses override onPaint to draw gradient rectangle. Main form also has 2 panels with same gradient. I'm trying to reduce drawing speed on form activation. But at the moment it is too noticeable for each user control to be drawn. Tried to use double buffering on main form and on each user control, looks almost the...
6
6666
by: Tom Rowton | last post by:
This one has me a bit confused and I'm not finding what I need in the MSDN or by searching these forums, so here goes... I have a rather large, complex code-in-page WebForm (don't ask) and a section of that Form is 4 or 5 ASP:Panels pretending to be a set of Tabs, each with its own section of the form.
5
2548
by: Henke | last post by:
Hi! I add some web user controls dynamicly with: myPanel.Controls.Add(Page.LoadControl("MyDynamiclyAddedPage.ascx")); the style of the controls on the user control is set from a css-class, by setting the CssClass-property, but they doesn't display properly. If the user control is added at design time everything looks correct.
1
2371
by: Chris | last post by:
novice question here... I am building a registration form while learning Asp.Net. I am having trouble passing data between "dynamically"-added server controls. To simplify, I have a single Registration.aspx page that contains 2 panels. Each panel is loaded with a user control during Page_Load(): protected Panel panel1; protected Panel panel2;
8
2523
by: dominique | last post by:
Hi, Is it possible (in vb.net with WinForms) to loop throw controls inside a container (form or panel) sorting the controls on a property (.tabindex for example) ? My problem : on several forms (or panels), i have many controls (inherited controls from base controls : MyTextbox, MyCombobox ..). I add a new property on these controls : .BeginningGroup (boolean : yes or no).
1
318
by: Jonathan Wood | last post by:
Okay, as evidenced by other questions, I am an experienced programmer very new to ASP.NET. I have a vertical navigation bar. It is all one color with several panels inside it with a different color. It looks okay but I'm wondering if each of these several panels should be Web User Controls themselves. I think this would make sense, and I can figure out how to add a property that specifies the image that appears at the top of each of...
1
1181
by: seanmayhew | last post by:
Ive got a page with all formatting and layout done with css no tables...It has approximately 60+ controls. All of the controls are in nested panels so i have a something like 6 primary panels and then each of those primary panels contain two sub-panels a left and a right these left and right panels contain the controls. For some reason I keep losing controls in the last panel on the page for instance the save button is missing....if I...
1
1950
by: johnson.bj | last post by:
I have a relatively minor problem that has been bugging me for a long time. I have created a user control which consists of a few panels and labels. What I want to do with this user control is to change its back color when the mouse hovers over it and to change the back color to its previous color when the mouse leaves the control creating the illusion of the control being highlighted. Now I assumed that after the user control was...
2
1485
JimWu
by: JimWu | last post by:
Do anyone know how to layout in Panel control. The code as follows labels.Text = "Album Name :"; labels.Text = "Title :"; labels.Text = "Tag :"; labels.Text = "Description :";
0
8608
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, 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...
0
8540
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,...
0
9086
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
8963
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
8803
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
5820
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
4324
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...
0
4557
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1959
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.