5
Answers

how to check all textbox on click btnsave

Ask a question
alaa

alaa

11y
1.3k
1
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)