472,363 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,363 software developers and data experts.

What's Faster...Repeater 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.HtmlControls.HtmlTable 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 3823
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********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.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.HtmlControls.HtmlTable 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.HtmlControls.HtmlTable 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
'salesTableRow10', 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********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.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.HtmlControls.HtmlTable 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
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...
0
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>...
3
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
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. ...
1
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...
0
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...
0
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...
0
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...
0
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...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.