Monday, May 28, 2007

Inserting from the ASP.NET GridView

Scott Mitchel, has this nice idea of using the footer or a GridView as an inserting panel, Since the GridView already misses the inserting functionality, unlike the FormView or the DetailsView.

Here is the tutorial:
http://www.asp.net/Learn/DataAccess/tutorial53vb.aspx?tabid=63

And he has a follow-up post on his blog to handle the case when the GridView has no rows!!
In this case the GridView unlike the old DataGrid won't display the footer nor the header...oops, (they should have gave us the option here) anyway, the workaround is to use the EmptyDataTemplate to put some controls (a DetailsView is a good option), and here are the full details:
http://scottonwriting.net/sowblog/posts/11904.aspx

No comments: