ASP.NET Partial postback issue

787 Views Asked by At

I have an ImageButton which, when clicked, calls a code-behind method that does some work and also changes the state of the ImageButton. I want to do a partial postback so that the entire page doesn't have to to load after clicking the ImageButton but also because I want the ImageButton as well as a Label next to it to update.

I figured I could use an UpdatePanel to accomplish this, but haven't had any luck. Here's what it looks like currently:

<asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="entry-vote">
            <div class="vote-left">
                <asp:ImageButton ID="thumb" runat="server" OnClick="Cast_Vote" />
            </div>
            <div class="vote-right">
                <span class="votecount"><%# Eval("Votes.Count") %></span>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>

When I click the ImageButton, it appears to wait about five seconds and then execute the code behind.

I've never worked with partial postbacks before, so I'm kind of just flying blind here.

1

There are 1 best solutions below

0
On BEST ANSWER

The delay only occurs while testing on localhost in Debug. Deploying in Release fixes the issue.