473,594 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's Faster...Repeat er or HTML Table

Hey folks,

I've got a DataGrid that has gotten a little out of control and really
slow because of its complexity (bunch of Template Columns too). For
performance reasons, I'm looking to change this.

I don't care about development time or even maintainability ...at this
point I need to go for fastest performance.

Which of the following do you think would be quickest?:
a) Repeater
b) Using System.Web.UI.H tmlControls.Htm lTable server side and building
out the table (adding it to the Page's Controls)
c) Building the html of the table into a string (using StringBuilder)
server side, and adding that to the inside of a panel

Bear in mind there is sorting and paging too which now has to be
built. Also, this C# 1.1.

Thanks!

Jul 27 '07 #1
3 3898
You will probably find all of them fairly similar in terms of perf. The
first option is the most maintainable.

StringBuilder might be a bit faster, as it is a dynamic array of characters,
but I would not opt for it first, as it is not maintainable.

I would also consider relooking at the DataGrid to make sure you cannot
filter the data before binding to accomplish what you are currently doing in
the Grid. It might speed things up considerably.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

*************** *************** *************** ***
Think outside the box!
*************** *************** *************** ***
"NullQwerty " <Nu********@gma il.comwrote in message
news:11******** **************@ k79g2000hse.goo glegroups.com.. .
Hey folks,

I've got a DataGrid that has gotten a little out of control and really
slow because of its complexity (bunch of Template Columns too). For
performance reasons, I'm looking to change this.

I don't care about development time or even maintainability ...at this
point I need to go for fastest performance.

Which of the following do you think would be quickest?:
a) Repeater
b) Using System.Web.UI.H tmlControls.Htm lTable server side and building
out the table (adding it to the Page's Controls)
c) Building the html of the table into a string (using StringBuilder)
server side, and adding that to the inside of a panel

Bear in mind there is sorting and paging too which now has to be
built. Also, this C# 1.1.

Thanks!

Jul 27 '07 #2
you need to determine if your performance problem is asp.net build the
page or the browser rendering the page.

for performance, turn off viewstate in the grid, and don't render more
than 10-15 rows.

-- bruce (sqlwork.com)

NullQwerty wrote:
Hey folks,

I've got a DataGrid that has gotten a little out of control and really
slow because of its complexity (bunch of Template Columns too). For
performance reasons, I'm looking to change this.

I don't care about development time or even maintainability ...at this
point I need to go for fastest performance.

Which of the following do you think would be quickest?:
a) Repeater
b) Using System.Web.UI.H tmlControls.Htm lTable server side and building
out the table (adding it to the Page's Controls)
c) Building the html of the table into a string (using StringBuilder)
server side, and adding that to the inside of a panel

Bear in mind there is sorting and paging too which now has to be
built. Also, this C# 1.1.

Thanks!
Jul 27 '07 #3
I've recently made similar descisions, and ended up building an HTML table
because all my rows we're not the same. I've also written paging code for it
as well. If all of your rows are the same, or you want to add additional
logic, then you may be better off with a repeater. If you do go down the
HTML route, I have a few pointers which will help.

If you want an event to fire from your table (e.g. you've got a link button
in a cell), then you need to create the table and the link buttons on every
load. You can't just build the rows and not bother on a post back if you're
not displaying them. To do this, I recommend that you have two functions - a
PrototypeTable( ) function and a PopulateTable() function.

In PrototypeTable to create the TableRows, TableCells and any Labels or
LinkButtons or other objects you'll need. You can set any event handlers
here as well. Set all the TableRows to invisible.

In PopulateTable, set the values of the labels and other objects, and set
the visibility.

The advantage of doing this is that you know what objects you have in your
program. You know you've always got ten TableRows called 'salesTableRow1 ' to
'salesTableRow1 0', and you can control the events. When you press the paging
controls, you get a postback which runs PrototypeTable( ), sets the start
index for your data and then runs PopulateTable() which will set the correct
values in the labels.

As I said earlier, a repeater is almost certainly easier to work with, but
if you want to create tables then this could save you a lot of time

"Cowboy (Gregory A. Beamer)" wrote:
You will probably find all of them fairly similar in terms of perf. The
first option is the most maintainable.

StringBuilder might be a bit faster, as it is a dynamic array of characters,
but I would not opt for it first, as it is not maintainable.

I would also consider relooking at the DataGrid to make sure you cannot
filter the data before binding to accomplish what you are currently doing in
the Grid. It might speed things up considerably.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

*************** *************** *************** ***
Think outside the box!
*************** *************** *************** ***
"NullQwerty " <Nu********@gma il.comwrote in message
news:11******** **************@ k79g2000hse.goo glegroups.com.. .
Hey folks,

I've got a DataGrid that has gotten a little out of control and really
slow because of its complexity (bunch of Template Columns too). For
performance reasons, I'm looking to change this.

I don't care about development time or even maintainability ...at this
point I need to go for fastest performance.

Which of the following do you think would be quickest?:
a) Repeater
b) Using System.Web.UI.H tmlControls.Htm lTable server side and building
out the table (adding it to the Page's Controls)
c) Building the html of the table into a string (using StringBuilder)
server side, and adding that to the inside of a panel

Bear in mind there is sorting and paging too which now has to be
built. Also, this C# 1.1.

Thanks!


Jul 28 '07 #4

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

Similar topics

2
1592
by: Mark | last post by:
I am trying to use a Pagable Repeater with checkboxes in ASP.Net, I cannot seem to associate the checkbox with a particular database record so I lose the checked state from page-to-page. Below is a sample 1-page ASP.Net apllication built to run against the SQL pubs database. There are contents of 2 files 1. ASPX, 2. ASPX.VB If there is anyway you can help, I'd really appreciate it.
0
2251
by: Rob Meade | last post by:
Hi all, Ok - I need to plonk a repeater in my form which is using a template (table and series of web user controls)...as a result I have something like this (short version) <table> <tr> <td>
3
2128
by: Mark | last post by:
I am looking for an example of using checkboxes in a repeater control where the checkbox state is persisted from page to page. Thank you, Mark
4
1713
by: bob garbados | last post by:
I need to create a page that displays all of the products from a table and allows for add to cart functionality. My thoughts were to display all of the products in table rows using a repeater. Each row has a text box for quantity to order and a button to add the product and quantity to the shopping cart. I can dynamically assign the CommandArgument to my button and figure out which one was clicked, but I can't figure out how to get the...
1
6405
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and binding it to a repeater control. This repeater control has multiple text boxes and buttons. Can you please tell me how can i do paging in this case ? I'm posting my code below. The problem is that if i click on "AdjustThisAd" button, it opens...
0
2787
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
0
2262
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of chkAll. I simply want to have chkAll be checked if every item in the repeater has its checkbox checked. In the code behind page, I can access the checked property of chkReconciled by doing the following: Dim CurrentCheckBox As CheckBox...
0
2553
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation link (1,2,3 so on). The code can be found in SubscriptionCart.aspx.cs. Default.aspx ------------
0
1164
by: Eugene Anthony | last post by:
BlogListingAll.aspx ------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="user_BlogListingAll.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
0
7946
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
7877
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
8240
tracyyun
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...
0
6661
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...
1
5739
isladogs
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...
0
3867
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
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
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
0
1216
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.