I got a UltraGrid control, i want to compare two values in the same column and if i find two values in the same column equal, i would like to extract that row by getting the row id. How can i do that.
Hi,
There's no built-in way to enforce unique values in the grid. If you are using a DataSet or DataTable, then I think the DataTable might have a way to do this. The DataColumn has properties to make the column a unique key, I think.
If your data source won't do this for you, then you would have to trap BeforeCellUpdate or BeforeRowUpdate in the grid and then loop through all of the rows to look for duplicates. If you find one, you would set e.Cancel to true.
How to force a condition that the particular column should not allow duplicate values?
For example : email column
plz help
Thanks alot.
You would have to loop through every row and examine the value of the cell in that column and trap for duplicates yourself. There's nothing built-in to the grid that could perform this kind of operation for you.
Another option would be to search through the data source rows, rather than the grid, but it's essentially the same thing. The DataSource might be a bit more efficient, though.