Roadmap › ASP.NET Web Forms — Page Life Cycle, ViewState, Controls and State Management › Module: Building Pages
Lessons in this course (10)
7. AJAX in Web Forms — ScriptManager, UpdatePanel and page methods
IntermediateMediumLesson 7 of 10
aspx
<asp:ScriptManager runat="server" />
<asp:UpdatePanel ID="upCart" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="lblCount" runat="server" />
<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress runat="server" AssociatedUpdatePanelID="upCart"><ProgressTemplate>Loading…</ProgressTemplate></asp:UpdateProgress>An UpdatePanel performs a partial postback: the whole page life cycle still runs on the server and the full ViewState is posted, but only the panel's HTML is replaced in the browser. It feels faster but isn't lighter on the server. Alternatives: [WebMethod] page methods / ASMX or Web API endpoints called with jQuery $.ajax / fetch for truly light calls.