Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
575
How to identify the duplicate cell
posted

Hi,

 

I am using this code but it has a couple of problems: 1. it does not focus to that cell 2. I see some other problems, such that if I move away and then change the cell it does not complain again!

 

        void gridDiscounts_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
        {
            this.IsDirty = true;
            if (e.Cell.Column.Key == "Name")
            {
                foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridDiscounts.Rows)
                {
                    if (e.Cell.Row != row)
                    {
                        if (e.Cell.Value != null && row.Cells["Name"].Value != null && e.Cell.Value != DBNull.Value
                            && row.Cells["Name"].Value != DBNull.Value)
                        {
                            if (String.Compare(e.Cell.Value.ToString(), row.Cells["Name"].Value.ToString(), true) == 0)
                            {
                                MessageBox.Show("This name already exists");
                                e.Cell.Row.Activate();
                                e.Cell.CancelUpdate();
                                e.Cell.Activate();
                                e.Cell.SelectAll();
                                e.Cell.Value = e.Cell.OriginalValue;
                          
                                break;
                            }
                        }
                    }
                }
            }
        }

Parents
No Data
Reply
  • 48586
    posted

    Hello, ­­­­­

     

    I am just checking about the progress of this issue. Let me know If you need my further assistance on this  issue?

     

    Thank you for using Infragistics Components.

Children
No Data