Slow Ajax postback - too much data?
Posted on 2008-11-18
This is complicated...
I have a repeater and in each item I have a table that contains an ImageButton.
When the ImageButton is clicked, I am using Ajax to populate another table within the appropriate repeateritem so that I can prompt the user for more information. This table-to-be-populated sits inside an UpdatePanel.
Here's the code for the updatepanel:
<asp:UpdatePanel ID="upd1" runat="server" UpdateMode="Conditional">
<asp:AsyncPostbackTrigger ControlID="imgBespoke" EventName="Click" />
<asp:Table ID="rtbDetails" runat="server" CssClass="subtable"></asp:Table>
Clicking the imagebutton sets a hiddenfield in the relevant repeateritem to "y" and then causes a postback, and it's actually in Page_Load that I then loop through all repeateritems, looking for ones where the hiddenfield is set to "y". If so, I find the table-to-be-populated (rtbDetails) and then create and add the new cells, rows and fields (all 55 of them).
I do this in Page_Load because I need to maintain the ViewState of my dynamically created fields as I need to know what the user puts into them - by putting in Page_Load they are re-created each postback in the same way.
Believe it or not, it works! The table is populated with the dynamic fields, I can retrieve the values on postback and all is splendid. Until however I moved it to our on-line development server, and now there's a 10 seconds delay between clicking the ImageButton and Ajax doing its bit once there's more than about 80 rows in the repeater. As this only happens on the remote server, I presume the delay is a download of Ajax info that is then used to update the page.
Why is it sending so much? I thought it would only send the necessary code to update the relevant UpdatePanel?
Is there something I'm missing? Can I meaningfully track what is being sent back from the server without digging into packet sniffers etc, and more importantly, can I restrict it?
Incidentally, the reason I'm trying to do this is that if I pre-render all of the 55 fields per row and hide them, the whole page expectedly becomes slow to respond when there are many rows.
Any help very much appreciated.
ASP.NET 2, Win 2003.
Both IE 7 and Firefox