I have a wingrid on my form. Before I save the data to the database I need to see if the required fields in the grid are filled out and not blank or empty.
Is there an easy way to do this other than looping through all the rows and cells?
I'm on Infragistics 6.3.
Thank you,
This isn't really something that the grid would do, it's more like a job for the data source. Most data sources allow you to set a property on the column indicatiing that the field is required. What kind of data source are you using for your grid?
Another ooption might be to use the ew UltraWinValidator component. But this component was added after v6.3, so you'd have to update in order to use that.
Thank for the replies. It's just that they can add a new row to the grid and the new row appears. Then they can go immediately to the save button to save. Rather than looping through all the cells in the row to determine if any are blanks, I thought there might be a validate event I could use. For example, if one cell value needs to be filled out I could click on it's properties and select "NeedsValidation" or "CannotBeBlank" and then the grid itself would determine if it has been filled out. But those properties don't exist. I'm guessing this isn't possible on 6.3?
Hi Tammy,
I assume that any date provided by the application is already valid, so you only need to validate the user's data. You could do this in a number of ways. You could use the BeforeCellUpdate event, for example, and validate that required cells are not left empty. You could also use BeforeRowUpdate if you prefer to validate a whole row at once instead of individual cells.
Of course, if you want to let the user enter blanks and then validate them only at the end when they are about to be written to the database, then you would have to loop through all of the grid rows and cells at once.
You can force the user to enter a value before leaving the cell.
Magued