Logical AND Example (C#)
<%@ Page Language="C#" %> <script runat="server"> void Page_Load() { if (IsPostBack){ DateTime datInput; datInput = Convert.ToDateTime(txtIn.Text); if ( datInput>=Convert.ToDateTime("1/1/2005") && datInput<=Convert.ToDateTime("12/31/2005")) lblOut.Text = "Date inside year 2005. " + datInput; } } </script> <html> <head> <title>Logical AND Example</title> </head> <body> <form runat="server"> Please enter a date, first in 2005. <br /> Next try a date not in 2005 <br /> <asp:TextBox id="txtIn" runat="server"></asp:TextBox> <br /> <asp:Button id="Button1" runat="server" Text="Submit"></asp:Button> <br /> <asp:Label id="lblOut" runat="server"></asp:Label> <br /> </form> </body> </html>