public cross_promotion() { InitializeComponent(); //UC EVENTS btn_dgv.AddClick += new btn_dgv.AddClickHandler(AddClick); btn_dgv.DeleteClick += new btn_dgv.DeleteClickHandler(DeleteClick); btn_dgv.RefreshClick += new btn_dgv.RefreshClickHandler(doLoadGridData); btn_dgv.SearchClick += new btn_dgv.SearchClickHandler(doLoadGridData); //PAGING DELEGATE btn_dgv.firstClick += new btn_dgv.firstClickHandler(doLoadGridData); btn_dgv.prevClick += new btn_dgv.prevClickHandler(doLoadGridData); btn_dgv.nextClick += new btn_dgv.nextClickHandler(doLoadGridData); btn_dgv.lastClick += new btn_dgv.lastClickHandler(doLoadGridData); btn_dgv.pageNumberChanged += new btn_dgv.pageNumberChangedHandler(doLoadGridData); btn_dgv.DGV.CellDoubleClick += (s, e) => { if (btn_dgv.DGV.SelectedRows.Count == 1) { using (cross_promotion_manage managePage = new cross_promotion_manage()) { managePage.cross_promotion_id = btn_dgv.DGV.SelectedRows[0].Cells["CROSS_PROMOTION_ID"].Value.ToString(); managePage.Owner = this; managePage.Text = "EDIT CROSS PROMOTION"; managePage.manage_btn.Text = "UPDATE"; managePage.ShowDialog(); } } }; }
// DELEGATE PART :: BEGIN void AddClick(object sender, EventArgs e) { GF.selected_id = 0; using (cross_promotion_manage managePage = new cross_promotion_manage()) { managePage.Owner = this; managePage.Text = "ADD CROSS PROMOTION"; managePage.manage_btn.Text = "ADD"; managePage.ShowDialog(); } }