コード例 #1
0
        // GridView.RowDeleting Event
        protected void RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int currentPrivateID = Convert.ToInt32(GridPrivates.Rows[e.RowIndex].Cells[2].Text);

            manager.DeletePrivate(currentPrivateID);
            // Populate the GridView.
            BindGridView();
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: maedakoma/AcademyRepo
        private void btnDelPrivate_Click(object sender, EventArgs e)
        {
            int currentPrivateID = Convert.ToInt32(gridPrivates.SelectedRows[0].Cells[0].Value);

            if (currentPrivateID != 0)
            {
                Private priv = privates.Where(x => x.ID == currentPrivateID).ToList <Private>()[0];
                manager.DeletePrivate(currentPrivateID);
                FillPrivatesGrid();
            }
            else
            {
                gridPrivates.Rows.Remove(gridPrivates.SelectedRows[0]);
            }
        }