在 GridView_RowCommand中获取主键的值 protected void GridView_RowCommand(object sender GridViewCommandEventArgs e) { int OrderId = ConvertToInt(GridViewDataKeys[ConvertToInt(eCommandArgument)]Value); } 在 GridView_PageIndexChanging中获取主键的值 protected void GridView_PageIndexChanging(object sender GridViewPageEventArgs e) { int index=GridViewDataKeys[eNewPageIndex]Value; } 在 GridView_RowDeleting中获取主键的值 protected void GridView_RowDeleting(object sender GridViewDeleteEventArgs e) { int index=GridViewDataKeys[eRowIndex]Value; } 在 GridView_RowEditing中获取主键的值 protected void GridView_RowEditing(object sender GridViewEditEventArgs e) { int index = GridViewDataKeys[eNewEditIndex]Value; } 在 GridView_RowUpdating中获取主键的值 protected void GridView_RowUpdating(object sender GridViewUpdateEventArgs e) { int index = GridViewDataKeys[eRowIndex]Value; } 在 GridView_RowDataBound中获取主键的值 protected void GridView_RowDataBound(object sender GridViewRowEventArgs e) { int index = GridViewDataKeys[eRowRowIndex]Value; } |