Adding New Rows

You probably want your DataGrid controls to serve as a replacement for desktop worksheets. One feature we haven’t discussed yet is adding rows dynamically. Before going any further, though, let me shed some light on the reasons that row insertion is not part of the DataGrid control’s set of functionality.

The DataGrid control is already complex. It comes with a wide range of events that, properly hooked up, offer extensive functionality. Adding even more events would have led to an overly complex and unwieldy control.

There are no serious reasons to drop the traditional implementation of the insertion functionality. Enabling the user to click a button somewhere on a page so that an input form pops up ready to collect and submit ...

Get Building Web Solutions with ASP.NET and ADO.NET now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.