private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { var index = dataGridView1.SelectedCells[0].RowIndex; var post = dataGridView1.Rows[index].DataBoundItem as PostDataGrid; if (post.UserId != ApiService.UserId) { btnEdit.Visible = false; } else { btnEdit.Visible = true; } if (ApiService.Permission == 2) { btnEdit.Visible = true; } FrmPostDetails frm = new FrmPostDetails(post.Id); frm.FormClosing += editFrm_FormClosing; frm.Show(); } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { var index = dataGridView1.SelectedCells[0].RowIndex; var post = dataGridView1.Rows[index].DataBoundItem as PostDataGrid; FrmPostDetails frm = new FrmPostDetails(post.Id); frm.FormClosing += editFrm_FormClosing; frm.Show(); } }