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)
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>
I've run into similar problems. My first line of defense was removing all the white space from within the repeater's template. This reduced the volume of data by about half (3.7 MB to 1.6MB) on a repeater that had 1600 repetitions. Since it's so easy to do ( in visual studio edit->advanced->remove horizontal whitespace) it's worth doing first thing.
Related
I am having an asp.net page which i was showing as a pop up using Nyromodel.
the page contains
4 div which is showing as Tabs (using Jquery Tabs).
4 Repeater .
Each repeater I am having a custom control and I am setting the
value from db by setting the datasource to repeater. (This query
may have 300-500 rows).
1 infragistics UltraWebGrid. I add
selected values to the grid.
So the problem is it is taking too much time to render if I perform any operation in that UI.
I logged the sp execution time, then I found that SP i taking only 2-3 seconds. But the control will render completely after 30-40 seconds.
So sp execution time alone is not enough to satisfy the my lead. So kindly help me how to analysis the time of rendering the control. Thanks for any Input
I would highly recommend you profile your web page using something like jetbrains's dotTrace or RedGate's profiler. They cost some $$ but highly worth it. You can probably download a trial in the mean time. I believe Visual Studio has some profiling built into it, but I've never been able to use as effectively as dotTrace.
i am facing a big speed problem with my application..we have to go for production but it got push backed becoz of this speed issue..
In my application..i have a page which is the main and important page of whole application..
in this page user spend most of the time...
in this page i am using 6 to 7 javascript files and jquery plugins..
whole page is ajax based and will do the jquery validations...
in this page i have 3 update panels (nested)..one update panel contains one formview and
other will contain one grid and a 4 formviews(will make visible of user selection..4 of the won't come at time..depends on grid view item i will get visible..like grid view record is type one then type one formview will visible on the page)..one update panel is parent update panel..
each formview contains more than 10 controls..dropdowns will load on formview onload event from database loopup tables..
this page won't refresh at all..because ever thing is in update panels..
i can't set the view state to false because of update panels..
i have to make more than 5 database calls each time..
this page works fine at the beginning of application start..after some amount of time its getting slower and slower..the database calls are pretty fast at the beginning and getting very slow after some time...
i don't know how to debug this thing and how to find which one causes this problem....please help me...
Update:
my view state is growing from 35 kb to 160 kb..
and i tried fullpost back triggers for some controls in updatepanels.. but the view state not getting down..its stays like that..on a double or triple browser refresh it got back to 35 kb..is this the issue?? thanks for your replies and suggestions...
I can't really help you if you don't show your code (specifically, the code the runs the database queries that start to slow down), but I can make one (hopefully good) guess:
It sounds like you might not be disposing your database connections properly. Every time you open a connection to the database, make sure you either wrap it in a try/finally block (where .Close() is called in the finally block) or create it with a using block.
You should look into a tool like JetBrains dotTrace that allows your monitor performance on a granular level. Then you will be able to see what the actual cause of your poor performance is. You get a 10 day trial at the website I linked to.
after a very long testing i found the problem...its because of update panels...we should not use update panel for too many controls..I didn't know that and the only control we have in asp.net is update panel for ajax..that's why i used the updatepanels...please stop using updatepanels and try to use jquery..i suffered a lot with this issue...thanks for your support guys...
I have a datagrid that is displaying data that is being returned from a stored procedure. That works fine. The problem is that I want to do sorting. I know that there is sorting functionality in the grid, however, I don't want to go back to the server and get a new set of data. What I want to do is just re-sort the data that is already being displayed.
Anyone have any ideas on how that is done?
Thanks!
UPDATE
Basically, I couldn't not find an easy solution to this issue. I tried updating my dataGrid to a gridView control and even that (for my particular issue) was difficult. I wound up un-doing all the changes and just adding another grid that had just the data I wanted for the requirement.
If anyone else has an issue like this I would recommend taking it out of a datagrid and writing it in jQuery. I could of written a table that had the data I wanted (and fully sortable using a plug-in mentioned below) in 15 minutes compared to the hours I spent trying to jam a square peg into a round hole.
One thing you can do is save the current result set into the users session, provided it isn't that large. You can then use the build in sorting capabilities of the DataGrid without dealing with a round trip to the database.
You will make a trip back to the server, but often the trip to the web server and back is far faster than the trip that involves the database.
It sounds like what you're wanting is to do the sorting on the client-side (the built-in grid sorting is server-side, and it sounds like you don't want the round trip). If you're using jQuery, there are some very easy plugins to handle sorting a on the client. For example, with the tablesorter plugin (http://tablesorter.com/docs/), you can do this with one line of code:
jQuery(".gv").tablesorter();
Where gv is a css class used for all my tables (GridView controls in an ASP.net application).
You'll need to make sure that your DataGrid is rending a <thead> and <tbody>, see related question for a Javascript way to add these, or you can do it from the codebehind in the PreRender event: ASP.NET 2.0 - DataGrid with tbody / thead
I've googled this to death and can't find anything that points me in the right direction so any help would be much appreciated!
I want to generate a report that consists of X no. of gridviews (X can vary) where each gridview is added one at a time using ajax (to avoid timeout of rendering all gridviews in single post back). I am also hoping that when rendering the next gridview a progress bar/timer can also appear in it's place until it's finished processing and is rendered.
Does anyone know how I might tackle this? I wouldn't have a problem doing this in a single post back but now the reports are timing out I need to generate the report piece by piece dynamically.
Thanks in advance!
Why don't you divide the page into different sections and load each section individually.
Are your gridviews interdependent..?
I want to show some results in a GridView kind of way.
But for each page I want to show 3 "inner Repeaters" showing data from 1-10,11 20 and 21-30 respectively. You can see this in the folowing image.
alt text http://img196.imageshack.us/img196/1285/examplesv.jpg
My question is, is this easier to buid with only one gridView, and several Item Templates,
OR should I buid a new user control from strach?
I'd recommend building your own user control from scratch for this. Even when used for its intended purpose (displaying table-based data), working with the GridView is like having a root canal.
In general, when it comes to non-standard UI elements (like what you're doing), you will probably end up spending much more time trying to hammer an existing control into the shape you need than you would just writing your own from the ground up.
Do you need all the functionality of a gridview, or are you just rendering and paging data? If not, then perhaps the Gridview is not the appropriate control to build from.
Also, be sure to look into the new ListView and datapager controls.
http://www.west-wind.com/WebLog/posts/127340.aspx
I'd have a close look at ExtJS's Grid. It's impressive looking and has a lot of features you need. The JS file generated may be a bit large though so maybe build your own if you're putting this on the internets.