It's not a trick, I think that implementation is just using the
built-in functionality of the datagrid.
I'm not where I can reference my book or look at my code, but here's
kinda how it goes generally...
When you look at the HTML of the datagrid, There is a <itemTemplate>
... </itemTemplate> inside of which is your layout for the data you
want to view - think of this as the "view mode". In this template
somewhere is a button (that you put there), in this case it looks like
a plus sign.
Datagrid has a property (I forget the exact name!) where you can tell
it what button will make the datagrid enter the "edit mode."
There is an <editTemplate> ... </editTemplate> inside of which is the
layout for the data for the "edit Mode". As "standard equipment"
datagrid defines "cancel" and "update" functions for the editTemplate.
These functions are triggered by buttons of course. Datagrid knows the
name of the functions, you have to write the code; and you supply the
buttons and must give them specific ID's so datagrid knows which button
does what.
To elaborate some more, the "view mode" can be showing any data, but
the idea is that the data is not in editable textboxes, etc. it's just
viewable. Clicking the "Edit" button changes to the "edit view" for
that record only - this is "standard functionality" of the datagrid -
and this view can be any data we want to show, and it should be in
editable textboxes, checkboxes, dropdown lists, etc. When we click the
"update" button, it executes the update-your-database code you've
written in the code-behind page. The datagrid provides properties and
eventhandler method names so you can 'wire up' your buttons and write
the code to handle your specific data.
I highly recommend this book:
http://www.amazon.com/ASP-NET-Data-...ef=sr_1_1/103-9895769-6253438?ie=UTF8&s=books
This
This book's author has also written extensive articles about datagrids
on
www.4guysfromrolla.com
Good Luck!