Update value in datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • esperanza

    Update value in datagrid

    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 (txtProduitVIPN o)

    Any Idea??

    thanks in advance !!

    Esperanza !!



    private void dgAdminCommande s_UpdateCommand (object source,
    System.Web.UI.W ebControls.Data GridCommandEven tArgs e)

    {



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

    TextBox txtProduitVIPNo m = (TextBox)e.Item .FindControl("t xtProduitVIPNom ");




    this.updCoopCom mandes.Paramete rs["@OrderID"].Value =
    dgCoopCommandes .DataKeys[e.Item.ItemInde x];

    this.updCoopCom mandes.Paramete rs["@ProduitVI PNo"].Value =
    txtProduitVIPNo .Text;

    this.updCoopCom mandes.Paramete rs["@ProduitVIPNom "].Value =
    txtProduitVIPNo m.Text;

    this.updCoopCom mandes.Paramete rs["@TMPSTP_AD M"].Value = System.DateTime .Now;

    this.sqlConn.Op en();

    this.updCoopCom mandes.ExecuteN onQuery();

    this.sqlConn.Cl ose();

    }


  • OHM \( One Handed Man \)

    #2
    Re: Update value in datagrid

    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 !

    --
    ( OHM ) - One Handed Man
    AKA Terry Burns - http://TrainingOn.net


    "esperanza" <esperanza222@h otmail.com> wrote in message
    news:%23smMuYaW GHA.2376@TK2MSF TNGP03.phx.gbl. ..[color=blue]
    > 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 (txtProduitVIPN o)
    >
    > Any Idea??
    >
    > thanks in advance !!
    >
    > Esperanza !!
    >
    >
    >
    > private void dgAdminCommande s_UpdateCommand (object source,
    > System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
    >
    > {
    >
    >
    >
    > TextBox txtProduitVIPNo = (TextBox)e.Item .FindControl("t xtProduitVIPNo" );
    >
    > TextBox txtProduitVIPNo m =
    > (TextBox)e.Item .FindControl("t xtProduitVIPNom ");
    >
    >
    >
    >
    > this.updCoopCom mandes.Paramete rs["@OrderID"].Value =
    > dgCoopCommandes .DataKeys[e.Item.ItemInde x];
    >
    > this.updCoopCom mandes.Paramete rs["@ProduitVI PNo"].Value =
    > txtProduitVIPNo .Text;
    >
    > this.updCoopCom mandes.Paramete rs["@ProduitVIPNom "].Value =
    > txtProduitVIPNo m.Text;
    >
    > this.updCoopCom mandes.Paramete rs["@TMPSTP_AD M"].Value =
    > System.DateTime .Now;
    >
    > this.sqlConn.Op en();
    >
    > this.updCoopCom mandes.ExecuteN onQuery();
    >
    > this.sqlConn.Cl ose();
    >
    > }
    >
    >[/color]


    Comment

    Working...