views:

25

answers:

1

I was busy implementing a repeater in an ASP.NET 4.0 to display data that I got from the database, I didn't start with building in paging so at the start allot of data was transfered. I filled a datatable and bound it as the datasource of my repeater.

I noticed the following, while the page was busy loading 4000 records(way to much ofc) 26mb was transfered. This is allot, so I got curious and implementer displaying the same data/html with a for each loop (ofc this is not a good solution load time wise). When the page was loading 10.5 mb was transfered this time.

How come that when using a repeater 26 mb (24 with viewstate disabled) is transfered, and when creating the HTML with a loop 10 mb? Is there anyway to optimize the repeater? I implemented just the basic(creating itemtemplate, filling datatable from database and binding it to the repeater)

A: 

The repeater will only output the code that you tell it to. So I would do what @Aristos said in their comment and compare the markup returned. If you could post the markup for the first record in both cases, that would be helpful for us to answer your question.

One other thing you might look at that I have come accross a couple of times. In Firefox in particular, if you have an empty javascript link like the one below, the entire markup of the page is retrieved rather than just nothing. Now this might just be a bug in the Firebug Add-On, but it might explain the doubling of the download size. Although I am not sure why this would be caused by using a repeater without seeing some code. It is worth bearing in mind.

<script type="text/javascript" src="" ></script>
Daniel Dyson