Hi i nedd to update a datatable binded in a gridview here is the code:

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        ds.Tables[0].Rows[e.RowIndex]["n1"] = Convert.ToInt32(((TextBox)(this.GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text);
        this.GridView1.DataBind();
        GridView1.EditIndex = -1;
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
    }

The problem is that when i change a value in the cell 3 and i click update it returns to the initial value, it doesent update the cell in the datatable.. thanks

Have you tried the GridView.UpdateRow Method("Use the UpdateRow method to programmatically update the record at the specified index in the data source.")? The MSDN article is here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.