Update value in datagrid

  • Thread starter Thread starter esperanza
  • Start date Start date
E

esperanza

Hello ASPX expert !!

Here is my problem.

I have a datagrid binded to a dataview.

I edit the datagrid and change the value of my textBoxes from my datagrid.

When I click to update the data,

What I read is the old values (txtProduitVIPNo)

Any Idea??

thanks in advance !!

Esperanza !!



private void dgAdminCommandes_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{



TextBox txtProduitVIPNo = (TextBox)e.Item.FindControl("txtProduitVIPNo");

TextBox txtProduitVIPNom = (TextBox)e.Item.FindControl("txtProduitVIPNom");




this.updCoopCommandes.Parameters["@OrderID"].Value =
dgCoopCommandes.DataKeys[e.Item.ItemIndex];

this.updCoopCommandes.Parameters["@ProduitVIPNo"].Value =
txtProduitVIPNo.Text;

this.updCoopCommandes.Parameters["@ProduitVIPNom"].Value =
txtProduitVIPNom.Text;

this.updCoopCommandes.Parameters["@TMPSTP_ADM"].Value = System.DateTime.Now;

this.sqlConn.Open();

this.updCoopCommandes.ExecuteNonQuery();

this.sqlConn.Close();

}
 
You need to add the Update event for your datagrid and then write code to
update the data using the information in the current row. Normall you will
store the ID column of your table in a hidden column and use this and the
values in the row to manually update the backend database.

Welcome to the world of the web !
 
Back
Top