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>
To fix the problem, you just need to set ClientIDMode="AutoID" on the control(s) which should trigger the UpdatePanel post back.
The UpdatePanel control contains a Button control that refreshes the content inside the panel when you click it.
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.
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With