Editable GridView with Add New/Insert button

Published: 8/14/2006 1:45:00 PM
Today I worked on implementing a GridView that would have the following features:
  1. Inline add/edit/delete
  2. Delete confirmation
  3. Data access through object data source

Out of the box GridView let's you edit/delete items inline, but not add them. There are a couple of pretty good solutions already available. Some notable articles are:

For my solution I decided to stick 'Add New' button above GridView. If user clicks on the button and gridview is empty -- a single empty row is created and set into 'Edit Mode'. If grid view has items when user clicks on 'Add New' -- new empty row is created right under the header and set to 'Edit Mode'.

There is no use of Footer and if the list is big enough it is a lot easier to see new items on top of the list instead of the bottom.

Anyways, without further delay, here is the GridView in action:

Click here to see the sample

I provided the code for VS 2005 web application. Let me know if you have any questions.

Download code here

blog comments powered by Disqus