xy15973
asked on
DataGrid Update Problem
Hi, When Updating the datagird the old values persist...any idees
Thanks
Code Snippet
++++++++++
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
sqlDataAdapter1.Fill(dataS et11);
DataGrid1.DataBind();
}
}
private void DataGrid1_EditCommand(obje ct source, System.Web.UI.WebControls. DataGridCo mmandEvent Args e)
{
DataGrid1.EditItemIndex = e.Item.ItemIndex;
DataGrid1.DataBind();
}
private void DataGrid1_CancelCommand(ob ject source, System.Web.UI.WebControls. DataGridCo mmandEvent Args e)
{
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
}
private void DataGrid1_UpdateCommand(ob ject source, System.Web.UI.WebControls. DataGridCo mmandEvent Args e)
{
int key = (int)DataGrid1.DataKeyFiel d[e.Item.I temIndex];
TextBox tx;
tx = (TextBox) (TextBox)e.Item.Cells[3].C ontrols[0] ;
string val = tx.Text;
DataSet1.tbl_BSR_Report_Ar chiveRow UpdateRow;
UpdateRow = dataSet11.tbl_BSR_Report_A rchive.Fin dByID(key) ;
UpdateRow.CommentTech = "There was a problem";
sqlDataAdapter1.Update(dat aSet11);
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
}
}
}
Thanks
Code Snippet
++++++++++
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
sqlDataAdapter1.Fill(dataS
DataGrid1.DataBind();
}
}
private void DataGrid1_EditCommand(obje
{
DataGrid1.EditItemIndex = e.Item.ItemIndex;
DataGrid1.DataBind();
}
private void DataGrid1_CancelCommand(ob
{
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
}
private void DataGrid1_UpdateCommand(ob
{
int key = (int)DataGrid1.DataKeyFiel
TextBox tx;
tx = (TextBox) (TextBox)e.Item.Cells[3].C
string val = tx.Text;
DataSet1.tbl_BSR_Report_Ar
UpdateRow = dataSet11.tbl_BSR_Report_A
UpdateRow.CommentTech = "There was a problem";
sqlDataAdapter1.Update(dat
DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.