using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class WebControls_CheckBox : System.Web.UI.Page
{
protected void Page_Load( object sender, EventArgs e)
{
}
protected void btnSubmit_Click( object sender, EventArgs e)
{
lblState.Text = string .Empty;
if (chkSport.Checked)
{
lblState.Text = lblState.Text + chkSport.Text;
}
if (chkSport2.Checked)
{
if (lblState.Text.Length == 0)
{
lblState.Text = chkSport2.Text;
}
else
{
lblState.Text = lblState.Text + "," + chkSport2.Text;
}
}
if (chkSport3.Checked)
{
if (lblState.Text.Length == 0)
{
lblState.Text = chkSport2.Text;
}
else
{
lblState.Text = lblState.Text + "," + chkSport3.Text;
}
}
}
}
|