Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

What's Faster...Repeater or HTML Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NullQwerty - 27 Jul 2007 17:03 GMT
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!
Cowboy (Gregory A. Beamer) - 27 Jul 2007 17:23 GMT
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.

Signature

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!
************************************************

> Hey folks,
>
[quoted text clipped - 16 lines]
>
> Thanks!
rival@newsgroups.nospam - 28 Jul 2007 11:38 GMT
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  

> You will probably find all of them fairly similar in terms of perf. The
> first option is the most maintainable.
[quoted text clipped - 26 lines]
> >
> > Thanks!
bruce barker - 27 Jul 2007 17:46 GMT
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)

> Hey folks,
>
[quoted text clipped - 16 lines]
>
> Thanks!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.