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
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.
Hi Yanko,
Thankyou for replying.
I am using MVVM pattern and IDataErrorInfo for the same.
Can you please suggest a way using MVVM with a small sample.
Rakesh