Over the long weekend I thought a lot about where I wanted to go with the grid “control” for ASP.NET MVC. One of the things that weighed heavily on my mind was the ability to have the control fully customizable. As I thought about this, I decided that first thing’s first: I need to get the functionality working and then worry about the prettiness factor. So for those of you concerned about the customizability - it’s coming. For now, I really want to focus on the ability of the grid to get work done.
As I began to dive again into the previous code I realized that having everything in one extension method was going to be… well ugly. The first order of business was to abstract everything in to a separate DLL. In order to do so, I created a new Grid class that handles all of the grid drawing.
- Detect that the user would like to edit a particular row
- Detect any rows previously being edited (to move the edit focus to the new row being edited)
- Display text boxes for the user to have the ability to edit the values
- Post back an edit or a delete
In order to do each of the items above, I needed to change what the grid was outputting a little. First I needed to wrap the table in a