Link to home
Start Free TrialLog in
Avatar of xy15973
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(dataSet11);
                  DataGrid1.DataBind();
                  }

                  
                  
            }



            
            

            

            private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
            {
                  DataGrid1.EditItemIndex = e.Item.ItemIndex;
                  DataGrid1.DataBind();
            }

            private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
            {
            DataGrid1.EditItemIndex = -1;
            DataGrid1.DataBind();
            }

            private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
            {
                  int key = (int)DataGrid1.DataKeyField[e.Item.ItemIndex];
                  
                  TextBox tx;
                  tx = (TextBox) (TextBox)e.Item.Cells[3].Controls[0];
                  string val = tx.Text;

                  DataSet1.tbl_BSR_Report_ArchiveRow UpdateRow;
                  UpdateRow = dataSet11.tbl_BSR_Report_Archive.FindByID(key);

                  UpdateRow.CommentTech = "There was a problem";

                  sqlDataAdapter1.Update(dataSet11);
                  DataGrid1.EditItemIndex = -1;
                  DataGrid1.DataBind();
            }

            

      
      }
}
ASKER CERTIFIED SOLUTION
Avatar of LindzK
LindzK
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of YZlat
YZlat
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial