Gridview, detailsview and inserting the first record
Posted on 2006-05-28
I've set up a very simple master/details page with a gridview (selectable rows) and a detailsview.
That works fine for updating, deleting and inserting as long as there is at least one record in the SQLtable.
The gridview has a SqlDataSource with this SelectCommand: "SELECT type_id, type FROM Types"
The detailsview has a SqlDataSource too with this SelectCommand: "SELECT type_id, type FROM Types WHERE type_id=@type_id"
That last SqlDataSource retrieves it's selectparamater (@type_id) from the datagrid's selectedvalue.
Now when there's no record in the database, no gridview appears. And thus no detailsview can be shown because @type_id isn't provided.
How can I show the detailsview (in defaultMode=Insert) so I can put the very first record of that SqlTable?
Hope I made myself clear enough
Thanks in advance