Exemple #1
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            if (RestrictionClass.restrictActionOnDefualtRow(dataBrand.SelectedRows))
            {
                return;
            }

            if (dataBrand.SelectedRows.Count > 0)
            {
                DialogResult dir = MessageBox.Show("Do you want to delete " + dataBrand.SelectedRows.Count + " Rows?", "Your Data will be delete", MessageBoxButtons.YesNo);
                if (dir == DialogResult.Yes)
                {
                    while (dataBrand.SelectedRows.Count > 0)
                    {
                        int index = dataBrand.SelectedRows[0].Index;
                        dataBrand.Rows.RemoveAt(index);
                    }
                    Clear();
                    update = true;
                }
            }
            else
            {
                MessageBox.Show("Please Select any data in List to Edit");
            }
        }
Exemple #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dataBrand.SelectedRows.Count == 1)
            {
                if (RestrictionClass.restrictActionOnDefualtRow(dataBrand.SelectedRows))
                {
                    return;
                }


                int index = dataBrand.SelectedRows[0].Index;
                dt.Rows[index].SetField("BrandID", lblID.Text);
                dt.Rows[index].SetField("BrandName", txtBarndName.Text);
                Clear();
                update = true;
            }
            else
            {
                MessageBox.Show("Please Select one data in List to Edit");
            }
        }