hi,
what would be the problem with this code because when I want to update it updates all the rest of the columns.
private void Update_dataGrid(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
System.Web.UI.WebControls.TextBox cstaff=new System.Web.UI.WebControls.TextBox();
cstaff=(System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0];
SqlCommand myCommand=new SqlCommand("update isp_email.staff set stafflevel=@stafflevel where id=id",con);
myCommand.Parameters.Add(
new SqlParameter("@stafflevel",SqlDbType.VarChar,45));myCommand.Parameters["@stafflevel"].Value=cstaff.Text;
con.Open();
myCommand.ExecuteNonQuery();
con.Close();
dgupdate.EditItemIndex=-1;
BindData();
}
PHANI NADIGADDAPosted Dec 14, 2006, 11:58 AM
----------
cstaff=(System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0];
Specify which item's textbox data you want.
e.Item[item index].FindControl("textbox");
ALL THE BEST.