private void button1_Click(object sender, EventArgs e) { FrmCategoryEdit frm = new FrmCategoryEdit(); frm.ShowDialog(); RefreshGrid(); }
private void button2_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count <= 0) { MessageBox.Show("Select row to Edit"); return; } DataRowView row = (DataRowView)dataGridView1.SelectedRows[0].DataBoundItem; CategoryEntity cat = new CategoryEntity(); cat.CatOrder = Convert.ToInt32(row["CatOrder"]); cat.Desc = row["Description"].ToString(); cat.Id = Convert.ToInt32(row["Id"]); cat.Name = row["Name"].ToString(); FrmCategoryEdit frm = new FrmCategoryEdit(cat); frm.ShowDialog(); RefreshGrid(); }