UpdatePanel en ASP.NET, attention au piège

En ASP.NET, l'UpdatePanel permet d’intéragir avec le serveur sans avoir à recharcher la page (mode asynchrone). Le code suivant affiche la date courante dans le label lors du click sur le bouton sans avoir à recharger la page : UpdatePanel.aspx <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:scriptmanager id="ScriptManager1" runat="server"> </asp:scriptmanager> <asp:updatepanel id="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Button ID="bt1" runat="server" Text="Button" onclick="bt1_Click" /> <asp:Label ID="lbl1" runat="server" Text="Label"></asp:Label> </ContentTemplate> </asp:updatepanel> </div> </form> </body> </html> UpdatePanel. [Voir plus]