I have 3 Column, the Item Code, Product Name, and Quantity. each column has 10 text boxes. I want to enable the save button once a row is filled and disabled if not. But my problem is how can I do that? this is what I tried so far:
public void showButtonSave()
{
if ((!String.IsNullOrEmpty(txtItem.Text) && !String.IsNullOrEmpty(txtProduct.Text) && !String.IsNullOrEmpty(txtQuantity.Text))
|| (!String.IsNullOrEmpty(txtItem2.Text) && !String.IsNullOrEmpty(txtProduct2.Text) && !String.IsNullOrEmpty(txtQuantity2.Text))
|| (!String.IsNullOrEmpty(txtItem3.Text) && !String.IsNullOrEmpty(txtProduct3.Text) && !String.IsNullOrEmpty(txtQuantity3.Text))
|| (!String.IsNullOrEmpty(txtItem4.Text) && !String.IsNullOrEmpty(txtProduct4.Text) && !String.IsNullOrEmpty(txtQuantity4.Text))
|| (!String.IsNullOrEmpty(txtItem5.Text) && !String.IsNullOrEmpty(txtProduct5.Text) && !String.IsNullOrEmpty(txtQuantity5.Text))
|| (!String.IsNullOrEmpty(txtItem6.Text) && !String.IsNullOrEmpty(txtProduct6.Text) && !String.IsNullOrEmpty(txtQuantity6.Text))
|| (!String.IsNullOrEmpty(txtItem7.Text) && !String.IsNullOrEmpty(txtProduct7.Text) && !String.IsNullOrEmpty(txtQuantity7.Text))
|| (!String.IsNullOrEmpty(txtItem8.Text) && !String.IsNullOrEmpty(txtProduct8.Text) && !String.IsNullOrEmpty(txtQuantity8.Text))
|| (!String.IsNullOrEmpty(txtItem9.Text) && !String.IsNullOrEmpty(txtProduct9.Text) && !String.IsNullOrEmpty(txtQuantity9.Text))
|| (!String.IsNullOrEmpty(txtItem10.Text) && !String.IsNullOrEmpty(txtProduct10.Text) && !String.IsNullOrEmpty(txtQuantity10.Text)))
{
btnAdd.Enabled = true;
}
else
{
btnAdd.Enabled = false;
}
additional informaton
Row must have a value of each columns to make the Button enable. Example, the user completely fill the 1st row of its every column then Button enables but once the user input only 1 column of the second row then the button starts to disable. To make the button enable the user must complete every column of the row.
btnAdd.Enabled). So assuming that you have a Save button calledbtnSave, why not just do the enabling/disabling in the exact same way? What exactly do you need help with?