Wednesday, May 25, 2005
A complicated DataGrid for ASP.NET (VB)
I've spent this past week working on a project which involved making a complicated DataGrid control. I will try to make a few posts about what I did, but basically, I needed the following features:
- A textbox to always display in the header of some columns so that the user can enter their own column title.
- Not only must one be able to edit and delete a row, but one must be able to add a row using text boxes.
- The changes to the data (new rows, updated rows, deleted rows) must not actually be made in the database until all of the edits are complete.
- The rows should automatically number themselves.
- Any column can be hidden or unhidden, whenever the user wants. Values store in a hidden column should not be destroyed.
- And for the most difficult requirement: in each column header, there must be a checkbox which (when checked) makes 2 additional textboxes appear in the header where one can enter minimum and maximum tolerances for the values stored in the column.
- When a row is added or updated, the values in each column must be checked against these tolerances to make sure they are valid. They also must be formatted correctly as either an integer or a number with 3 or less decimal places (depending on the column).
- All of the values entered should be validated using the built in ASP.NET validation controls so that a single message can summarize all of the errors.