alaa

alaa

  • NA
  • 166
  • 51k

how to check all textbox on click btnsave

Jul 19 2013 6:11 AM
how to check all textbox on click btnsave if there is no empty text box do something else message error that you have to need to fill empty textbox frist
i try this code

foreach (Control c in this.Controls)
{
if (c is TextBox)
{
TextBox textBox = c as TextBox;
if (textBox.Text == string.Empty)
{
textbox.text="please fill your empty textbox ";
}

else
{
// if my textbox all are fill i put my code to save data in datebase here
}
}
}



i try this code but it do nothing ????

Answers (5)