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
985
xamGrid Validating record getting entered from new row control against a whole collection
posted

Hi

Can anyone please tell how to work on validating the record entered from new row control(xamgrid) against the above existing records.

For eg. To check if duplicate records are not getting entered by the user from teh new row control.

I will highly appreciate if you can send me a small sample.

Thanks in advance.

Rakesh Bisht

Parents
No Data
Reply
  • 35319
    posted

    Hello Rakesh,

     

    I have been looking into your question and if you want to make some validation when adding new row in the XamGrid control, the best choice is on ‘RowAdding’ event. For example, if you want to restrict the adding of a new row which has the same data as an existing one you can do the following check in the event’s body :

     

    private void xamGrid1_RowAdding(object sender, Infragistics.Controls.Grids.CancellableRowAddingEventArgs e)

            {

                foreach (Row item in this.xamGrid1.Rows)

                {

                    if (e.Row.Cells[0].Value.ToString() == item.Cells[0].Value.ToString() && e.Row.Cells[1].Value.ToString() == item.Cells[1].Value.ToString())

                    {

                        e.Cancel = true;

                    }

                }

            }

     

    Let me know, if you need any further assistance on this matter.

Children