Text Box Error
I would like to display an error on the textbox if i left it empty. Some thing like the text box should get highlighted with some sort of color when i submit .
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Todd BurrellPosted Jun 17, 2010, 7:56 PM
protected void submitButtonClick(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
TextBox1.BackColor = System.Drawing.Color.Yellow;
return;
}
else
{
//do something else
}
}