この質問を読んだばかりですが、まだ理解していない場合は、aspxファイルに移動し、gridviewで「OnRowEditing」を定義してください。次に、コードビハインドファイルに戻り、次のようにします。
protected void gvEvents_Edit(object sender, GridViewEditEventArgs e)
{
//Set the edit index.
gvEvents.EditIndex = e.NewEditIndex;
DataTable dt = Session["dtEvents"] as DataTable;
//Bind data to the GridView control.
gvEvents.DataSource = Session["dtEvents"];
gvEvents.DataBind();
}
また、OnRowUpdatingとOnRowCancelingEditを定義し、それらのコードをコードビハインドに配置する必要があります。これはOnRowCancelingEditの下にあるものです
protected void gvEvents_cancEdit(object sender, GridViewCancelEditEventArgs e)
{
//Reset the edit index.
gvEvents.EditIndex = -1;
//Bind data to the GridView control.
DataTable dt = Session["dtEvents"] as DataTable;
gvEvents.DataSource = Session["dtEvents"];
gvEvents.DataBind();
}