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");
}
}
}
Loading
Jiteendra SampathiraoPosted Jul 8, 2011, 2:18 AM
use required field Validator to both controls....
Sandeep PantPosted Jul 8, 2011, 1:09 AM
{
if(textBox1.Text.Trim().Length==0)
{
MessageBox.Show("Enter text in textBox1");
}
if (textBox2.Text.Trim().Length==0)
{
MessageBox.Show("Enter text in textBox2");
}
else
{
MessageBox.Show("OK you have filled both textbox");
}
}