M
Mo Saghir
I have a problem where I am trying to update a DataGrid command in place
pretty much as outlined in the various samples in MSDN:
private void InitialGrid1_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
TextBox txtID = (TextBox)e.Item.Cells[1].Controls[0];
TextBox txtName = (TextBox)e.Item.Cells[2].Controls[0];
Label1.Text = txtID.Text + "-" + txtName.Text + "-";
InitialGrid1.EditItemIndex = -1;
BindData();
}
Whenever I try to access the TextBox.Text field, I get blank if the value
was updated by the user. However, if the value is left untouched then it is
successfully propagated to TextBox.Text field. I've been trying to debug
this for a while now but I am reaching a dead end. The MSDN samples don't
mention any additional details that may pertain to this situation.
Moreover, the data binding is done via:
....
MyConnection.Open();
SqlDataAdapter myCommand = new SqlDataAdapter("select * from UserTable",
MyConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "UserTable");
InitialGrid1.DataSource = ds;
InitialGrid1.DataBind();
MyConnection.Close();
Any help would be appreciated as this is currenlty blocking me.
pretty much as outlined in the various samples in MSDN:
private void InitialGrid1_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
TextBox txtID = (TextBox)e.Item.Cells[1].Controls[0];
TextBox txtName = (TextBox)e.Item.Cells[2].Controls[0];
Label1.Text = txtID.Text + "-" + txtName.Text + "-";
InitialGrid1.EditItemIndex = -1;
BindData();
}
Whenever I try to access the TextBox.Text field, I get blank if the value
was updated by the user. However, if the value is left untouched then it is
successfully propagated to TextBox.Text field. I've been trying to debug
this for a while now but I am reaching a dead end. The MSDN samples don't
mention any additional details that may pertain to this situation.
Moreover, the data binding is done via:
....
MyConnection.Open();
SqlDataAdapter myCommand = new SqlDataAdapter("select * from UserTable",
MyConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "UserTable");
InitialGrid1.DataSource = ds;
InitialGrid1.DataBind();
MyConnection.Close();
Any help would be appreciated as this is currenlty blocking me.