Exemplo n.º 1
0
        private void btnPayment_Click(object sender, EventArgs e)
        {
            ADPaymentEntry obj = new ADPaymentEntry(Convert.ToInt32(lblADID.Text));

            //Bind the datagridview values in the second popup form
            obj.Controls["lblADID"].Text = lblADID.Text;
            obj.ShowDialog();
        }
        private void gvAdListgrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //Check whether user click on the first column
            if (e.ColumnIndex == 0 && e.RowIndex != -1)
            {
                int row;
                //Get the row index
                row = e.RowIndex;
                if (gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString() == "")
                {
                    return;
                }
                //Create instance of the form2 class
                ADEntryForm obj = new ADEntryForm(Convert.ToInt32(gvAdListgrid.Rows[row].Cells["ADID"].Value));
                //Bind the datagridview values in the second popup form
                obj.Controls["lblADID"].Text = gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString();
                obj.Controls["btnSave"].Text = "Update";
                obj.ShowDialog();
            }

            if (e.ColumnIndex == 1 && e.RowIndex != -1)
            {
                int row;
                //Get the row index
                row = e.RowIndex;
                if (gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString() == "")
                {
                    return;
                }
                //Create instance of the form2 class
                ADPaymentEntry obj = new ADPaymentEntry(Convert.ToInt32(gvAdListgrid.Rows[row].Cells["ADID"].Value));
                //Bind the datagridview values in the second popup form
                obj.Controls["lblADID"].Text = gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString();
                obj.ShowDialog();
            }
        }