1SeoAdvies
1SeoAdvies

Reputation: 103

Update Panel refreshes whole page

On a masterpage I have my scriptmanager with enablepartialrendering is true. On the page I have a usercontrol, on this usercontrol is an update panel with Updatemode is conditional.

It's about two listboxes that swapped an item from the left listbox to the right listbox by clicking on an imagebutton. (This works fine)

The two imagebuttons are in a div block for the stylesheet. I use the postbacktrigger for them. Still the whole page refreshes, what am I doing wrong?

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DoubleListBox.ascx.cs" 
Inherits="site.Controls.DoubleListBox" %>
<div class="formfield ff_itemswapper">
<asp:Label ID="Label" runat="server" />
<div class="itemswapper">
    <asp:UpdatePanel ID="updatePanelListboxes" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:ListBox ID="lsbFrom" runat="server" CssClass="is_current"></asp:ListBox>
            <div class="is_transfers" runat="server">
                <asp:ImageButton ID="imb_Left" runat="server" CssClass="is_transfer_in" ImageUrl="../Images/gfx/arrow_left.png"
                    OnClick="imbLeft_Click" CausesValidation="False" />
                <asp:ImageButton ID="img_Right" runat="server" CssClass="is_transfer_out" ImageUrl="../Images/gfx/arrow_right.png"
                    OnClick="imgRight_Click" CausesValidation="False" />
            </div>
            <asp:ListBox ID="lsbTo" runat="server" CssClass="is_source"></asp:ListBox>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="imb_Left" />
            <asp:PostBackTrigger ControlID="img_Right" />
        </Triggers>
    </asp:UpdatePanel>
</div>

The listbox is registered in the aspx page by

<%@ Register Src="~/Controls/DoubleListBox.ascx" TagName="DoubleListBox" TagPrefix="lsb" %>

And called by:

<lsb:DoubleListBox ID="lsbPractise" runat="server" />

Upvotes: 3

Views: 18355

Answers (1)

Devin Burke
Devin Burke

Reputation: 13820

You seem to misunderstand what a PostBackTrigger does.

A PostBackTrigger causes a full page postback, whereas an AsyncPostBackTrigger does an AJAX call from within the UpdatePanel. All elements inside the UpdatePanel automatically call AsyncPostBackTriggers and all elements outside the panel call PostBackTriggers.

So, to solve your problem, simply remove your entire Triggers section.

Upvotes: 9

Related Questions