ASP Net Controls ASP.Net Tutorial

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"  Inherits="CheckBoxTest" %>



    Check Box Test


   
   
      

Check Box Test


      
         Delivery:
                     OnCheckedChanged="CheckChanged" AutoPostBack="True" />
                                   runat="server" 
                       Text="Customer Address: "   
                       Visible="false" />
                                     runat="server" 
                         Columns="60" 
                         Visible="False" />
         Pizza Styles: 
         
         
         
      

               Text="Order Pizza" OnClick="btnOrder_Click" />
      
   

   


File: Default.aspx.cs
 
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class CheckBoxTest : System.Web.UI.Page
{
  protected void CheckChanged(object sender, System.EventArgs e)
  {
    if (chkDelivery.Checked)
    {
      txtAddress.Visible = true;
      labAddress.Visible = true;
    }
    else
    {
      txtAddress.Visible = false;
      labAddress.Visible = false;
    }
  }
  protected void btnOrder_Click(object sender, EventArgs e)
  {
    labMessage.Text = "Pizza Order Styles: 
";
    if (chkThin.Checked)
      labMessage.Text += chkThin.Text + "
"; ;
    if (chkExtra.Checked)
      labMessage.Text += chkExtra.Text + "
"; ;
  }
}