I'm using the following code to pass data to a table in my database. The datagrid consists of a bound column and 3 template columns (2 textboxes and a chackebox).
The problem is that the values of these template columns cannot be read. (i.e. in the following code, values of qtyTextBox and desTextBox are "" and addChackBox.Checked is always 'false' even if it is checked).
HELP!!!
for (int i = 0; i < dgaddf.Items.Count; i++)
{
DataGridItem item = dgaddf.Items[i];
string it = item.Cells[1].Text.ToString();
TextBox qtyTextBox (TextBox)item.FindControl("txtQ");
TextBox desTextBox=(TextBox)item.FindControl("txtD");
CheckBox addCheckBox = (CheckBox)item.FindControl("Chk1");
if (addCheckBox.Checked)
{
br.createFloRec(it, int.Parse(qtyTextBox.Text), desTextBox.Text, connect1.con);
// the function that adds data to the DB
}
}