How to avoid duplicate values in a column? is there any built functionality or else must do iteration through rows.If so in which event i can write?
I would not use InitializeRow for this. InitializeRow will fire multiple times for the same row, so keeping track of your list inside that event would be pretty complicated.
If you want to build a list outside the grid and maintain, then what I would do is created your list by looping through all the rows of the grid and building the list up-front. Then you can track changes in events like BeforeRowUpdate and BeforeRowsDeleted.
One thing you could do is use the InitializeRow event to add each email column cell value to a HashTable, and then handle either of the events Mike suggested (BeforeCellUpdate or BeforeRowUpdate). In either of those events you can use the Contains method from your HashTable, and set e.Cancel to true if the Contains method returned true.
I loaded all the details of customer in grid by assigning
grd .DataSource = dtDtl
In which i have number of columns
i'm allowing to edit email column,
so i have to validate whether any two customer has same email iD
karthimca07 said: How to avoid duplicate values in a column? is there any built functionality or else must do iteration through rows.If so in which event i can write?
Where exactly are you pulling a data source from? Personally, I think avoiding duplications should be taken care of at the source of the data prior to being binded to a grid. For example, if you're using data from a SQL Server table and you want to avoid duplicate values in columns, then that table should be given UNIQUE constraints for that particular column.
Depending on what kind of data source you're using there might exist a really fast optimized method for removing duplicates. Accessing rows to build some sort of HashSet/ArrayList/etc for checking in say the InitializeRow event of the UltraGrid is possible, but really inefficient.