Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Custom Validator in ASP.Net DataGrid

Is it possible to use a Custom Validator control in an ASP.Net datagrid template column that use server side validation? It works if I use ClientScript validation, but I need to hit the server and do a table lookup on the data I'm am trying to validate. I can't seem to find any example of this.

Bill
Tuesday, August 26, 2003

If you're going to have to make a round-trip to the server to look something up in the database, then have the datagrid's "update" subprocedure run the new data against the table-lookup, and if it fails, alter the text of a label on the page (or otherwise indicate there's a problem, hopefully with an explanation why), and exit the sub there.

That way, the datagrid is left in it's edit state, there's an error message, and the user can try again.

Greg Hurlman
Tuesday, August 26, 2003

Thanks, Greg.
That is what I ended up doing, although I didn't think to stop the EditItemIndex update if there was an error. I've made the change and it works great.

Bill
Wednesday, August 27, 2003

No problem :)

Greg Hurlman
Wednesday, August 27, 2003

*  Recent Topics

*  Fog Creek Home