Valon Ademi

Valon Ademi

  • NA
  • 5.1k
  • 1.2m

If Condition?

Jul 8 2011 12:43 AM
Hi... I have created two text boxes I want that if user enter value in first text box and also in second text box. If user not enters any value neither first text box nor second text. Then he would get an error message.
You can do changes in below code that I have.

Code:

protected void Button1_Click(object sender, EventArgs e)
   {
       if (Label1.Text.StartsWith(TextBox1.Text))
 {
 MessageBox.Show(TextBox1.Text, "Found");
 }
 else
     
        {
 if (Label1.Text.EndsWith(textbox2.Text))
 {
 MessageBox.Show(textbox2.Text, "Found");
 }
 else
 {
 MessageBox.Show("Not Found");
 }
 }




Answers (2)