0

This is a difficult problem so I found how to solve when cell on table don't receive input value from user . Please show me how retrieve value from updated cell . Please help me . I am very boring because of seeing this problem

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    int id;

    id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());

    foreach (GridViewRow row in GridView1.Rows)
    {
        value1 = row.Cells[2].Text;//Only receive lastest value . Cann't receive value when it is updated
    }

    //Response.Write("Check value" + value1);
    DataClassesCheckDataContext ctx = new DataClassesCheckDataContext();
    ctx.EditStudentProc(id, value1);
    GridView1.DataSource = ctx.Students;
    GridView1.EditIndex = -1;
    GridView1.DataBind();
}
Jason
  • 86,222
  • 15
  • 131
  • 146
  • Why are you looping through every row in your table when e.RowIndex tells you which row was updated? Why are you re-binding your data on every update event? – Jason May 09 '13 at 15:31
  • looping use to try finding value of cell and databind() to load immediately after activing – hkijnio jpjp May 09 '13 at 16:30

1 Answers1

0

On RowUpdating the updated values are in e.NewValues, Ref http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdateeventargs.newvalues.aspx

SteinIP
  • 376
  • 4
  • 5