473,320 Members | 2,145 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,320 software developers and data experts.

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 2218
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*****@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.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
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...
6
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...
5
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...
1
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...
8
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...
1
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...
1
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...
1
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...
2
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.