0

这是一个难题,所以我找到了如何解决 table 上的单元格没有收到来自 user 的输入值的问题。请告诉我如何从更新的单元格中检索值。请帮我 。因为看到这个问题我很无聊

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

1 回答 1

0

在 RowUpdating 更新的值在 e.NewValues 中,参考http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewupdateeventargs.newvalues.aspx

于 2013-05-09T16:48:07.207 回答