Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Server Control causes full postbacks inside of UpdatePanel

I have a custom server control that seems to work fine until I put it in an UpdatePanel. Once inside the UpdatePanel it continues to work fine but the UpdatePanel now does full postbacks when my custom server control does a postback.

Do I need to do anything to make my custom server control do async postbacks while inside an UpdatePanel?

Here is the relevant code that is causing a full postback. The ecs:Pager control is my custom control that causes full postbacks on the OnCommand event even though it is in the UpdatePanel.

<asp:UpdatePanel ID="ClosedIssuesUpdatePanel" runat="server">
    <ContentTemplate>
        <ecs:Pager ID="ClosedIssuesPager" OnCommand="ClosedIssuesPager_Command" runat="server" />
        <asp:Repeater ID="ClosedIssuesRepeater" runat="server">
        ....
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>
like image 991
DarenTx Avatar asked Jun 02 '09 20:06

DarenTx


People also ask

How do I stop UpdatePanel from causing the whole page postback?

To fix the problem, you just need to set ClientIDMode="AutoID" on the control(s) which should trigger the UpdatePanel post back.

What happens when a button placed in the UpdatePanel control is clicked?

The UpdatePanel control contains a Button control that refreshes the content inside the panel when you click it.

What is postback trigger in UpdatePanel?

AsyncPostBackTrigger - use these triggers to specify a control within or outside of the UpdatePanel that, when clicked, should trigger a partial page postback. PostBackTrigger - use these triggers to have a control within the UpdatePanel cause a full page postback rather than a partial page postback.

What is UpdateMode conditional in UpdatePanel?

If the UpdateMode property is set to Conditional, the UpdatePanel control's content is updated when one of the following is true: When the postback is caused by a trigger for that UpdatePanel control. When you explicitly call the UpdatePanel control's Update method.


1 Answers

Put the update mode of your update panel to conditional.

<asp:UpdatePanel ID="ClosedIssuesUpdatePanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <ecs:Pager ID="ClosedIssuesPager" OnCommand="ClosedIssuesPager_Command" runat="server" />
        <asp:Repeater ID="ClosedIssuesRepeater" runat="server">
        ....
        </asp:Repeater>
    </ContentTemplate>
</asp:UpdatePanel>
like image 132
Cédric Boivin Avatar answered Oct 06 '22 18:10

Cédric Boivin