1
votes

I'm trying to speed up my Repeater so that not as much HTML has to be resent via the AJAX UpdatePanel on each call.

So here's what I have (a very much simplified version):

<asp:Repeater ID="rptContactSteps" runat="server">
    <ItemTemplate>

            <p>Script:<br /><%#mobjSDIT.FormatText(Eval("script"))%></p>
            <p>Notes:<br /><%#mobjSDIT.FormatText(Eval("notes"))%></p>

            <asp:UpdatePanel ID="upStep" runat="server" UpdateMode="Conditional">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="rptContactSteps" EventName="ItemCommand" />
                </Triggers>
                <ContentTemplate>

                    <p>Contact/Step Notes:<br /><%#mobjSDIT.FormatText(Eval("contact_step_notes"))%></p>

                    <asp:ImageButton ID="btnSaveAndCompleteLastStep" runat="server" ImageUrl="~/images/content/buttons/save-and-complete-button.png" CommandArgument='<%#Eval("step_contact_tie_id")%>' />

                </ContentTemplate>
            </asp:UpdatePanel>

    </ItemTemplate>
</asp:Repeater>

So, when I click 'btnSaveAndCompleteLastStep' I want all the UpdatePanel in 'rptContactSteps' to update. Having the UpdatePanel inside the ItemTemplate should help prevent having to re-load the html/text that populates the Eval("script") & Eval("notes"), since the value of these variables could be very large and over a 3G connection this could be very costly (in time & money).

I though by adding the async trigger it'd work as I have used this type of trigger before, but not when inside the Repeater. Currently the UpdatePanels aren't getting updated at all, except from the one from which the button was pressed.

Any ideas anyone?

2
why don't you try to make the default click event of the ImageButton, copy-paste the ItemCommand code and change the event name for the ImageButton "Click" in the AsyncPostBackTrigger. That work for me. - Roberto Alarcon
Update panel and Ajax don't belong in the same sentence. I suggest you take a look at this article: encosia.com/2007/07/11/… The author explains that he saw a 4,000% improvement using Ajax instead of update panels. - The Muffin Man
Nick, I appreciate that 'writing' my own AJAX would be faster as I do this on a regular basis but for rapid development I find UpdatePanels very handy. - Darthtong

2 Answers

0
votes

They aren't getting updated except by the one that is called because the update mode is set to conditional, and by default the ChildrenAsTriggers is set to true. So if you want them all to update when one of them is changed, then you will need to find each of the update panels in each of the repeater items and call .Update() on the update panel, or you can change the update mode to "Always", or just wrap your repeater in an update panel instead of wrapping just the items.

Does that make sense? If not I can expand.

0
votes

That behavior sounds ok to me because postback from within an updatepanel will not update anything outside of it by default.

One way you can try is on your btnSaveAndCompleteLastStep click , find each updatepanel in the repeater items and call Update() on it.