DropdownList and checkbox control in Asp.Net examples
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
Label3.Text = "you have selected:" + DropDownList1.SelectedItem.Text;
}
}
checkbox
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = "your choice is:";
if (Apple.Checked == true)
str += Apple.Text+"|";
if (Mango.Checked == true)
str += Mango.Text+"|";
if (Banana.Checked == true)
str += Banana.Text +"|";
if (Graps.Checked == true)
str += Graps.Text +"|";
Label1.Text = str;
if(str=="your choice is:")
Label1.Text = "select choice then submit";
}
}
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
Label3.Text = "you have selected:" + DropDownList1.SelectedItem.Text;
}
}
checkbox
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string str = "your choice is:";
if (Apple.Checked == true)
str += Apple.Text+"|";
if (Mango.Checked == true)
str += Mango.Text+"|";
if (Banana.Checked == true)
str += Banana.Text +"|";
if (Graps.Checked == true)
str += Graps.Text +"|";
Label1.Text = str;
if(str=="your choice is:")
Label1.Text = "select choice then submit";
}
}
0 comments: