Page.IsPostBack (C#) : Post Back « Page Lifecycle « ASP.NET Tutorial






<%@ Page Language="C#" %>

<script runat="server">
   void Page_Load(Object Sender, EventArgs e) {
      if (!Page.IsPostBack) {
         lblMessage.Text = "Hello world!!!!";
      }
   }
   
   void Submit(Object Sender, EventArgs e) {
      lblMessage2.Text = "Form posted";
   }
</script>

<html><body>
   <form runat="server">
      <asp:Button id="btSubmit" runat="server" Text="Submit" onClick="Submit" />
      
      <asp:Label id="lblMessage" runat=server />
      
      <asp:Label id="lblMessage2" runat=server />
   </form>
</body></html>








5.5.Post Back
5.5.1.Page.IsPostBack (C#)
5.5.2.Save value to view state (VB.net)