Update value in datagrid

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();

}
 
O

OHM \( One Handed Man \)

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 !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top