Mega Code Archive

 
Categories / ASP.Net / Page
 

Page IsPostBack Demo (C#)

<%@ Page Language="C#" Debug="true" %> <script runat="server"> void Page_Load(){    if (Page.IsPostBack){        string[] choice = new string[3];        choice[0] = "1";        choice[1] = "2";        choice[2] = "3";        lblShipper.Text = "Shipper ID for " + txtShipNum.Text + " is " + Array.IndexOf(choice, txtShipNum.Text);        lblShipper.Visible = true;    } } </script> <html> <head>     <title>Array Example</title> </head> <body>     <form runat="server">         Please enter your shipper name.          (should be "1"  or  "2"  or  "3")          <br><asp:TextBox id="txtShipNum" runat="server" width="300px"></asp:TextBox>         <br />         Press button to find the Shipper ID number         <asp:Button id="Button1" runat="server" Text="Submit"></asp:Button>         <br />         <asp:Label id="lblShipper" runat="server"></asp:Label>     </form> </body> </html>