I recently had need for a ASP.NET WebForms grid that would do something you’d think would be relatively simple:
- Allow the user to enter ‘rows’ of some set of data (for instance, multiple address/city/state)
- Allow the user to update/delete all of these rows of data, almost like an Excel sheet
- Keep that data in a ‘holding pattern’ on the form (via ViewState) until such time they ‘submit’ the form to be persisted, emailed, etc.
- Not use any databinding, database backing, or session – just ViewState
I looked and I looked, but I couldn’t find anything that quite fit right. I tried to implement a GridView using ObjectDataSource, wrapped around ViewState, but I couldn’t get it to work. I tried some jQuery grids, GridView, etc, and these all seem to want to talk to a database (or some persistence somewhere). I tried a plain old ListView/Repeater, but the dynamically added user controls (i.e. my ‘rows’ of data), disappear after postback.
Since I couldn’t find the perfect fit (it may still be out there), I just created my own (with some serious help from this guy).
Yes, StupidGrid, available on CodePlex. Why the name?
- It doesn’t bind to any database or persistence: once the user leaves the page, StupidGrid stupidly forgets anything the user entered.
- I couldn’t find a decent (free) grid to do what I wanted, so as I was looking around for one, I kept saying “I just need a stupid grid!”
- It’s stupidly simple to use (or, at least, that’s my goal): just build a user control you want to repeat, “feed” its path to the UserControlPath property, and you’re done.
I’ve just done an official release of version 0.1, which I’m sure has many problems, so I would be ecstatic to hear any opinions, suggestions, patches, criticisms, bug reports, problems, etc.
And if anyone wants to design a better logo or icon, leave a comment or hit me on Twitter.