Groups | Blog | Home
all groups > asp.net > july 2007 >

asp.net : detailview insert if there is no record


Ganesh
7/25/2007 8:06:14 PM
Hi There,

I use detailView to edit, insert and delete data. It gets value from
datagrid.selectedvalue. How can i insert a record initially. If there is not
any record in the grid, still i would like to have Insert from details view.

can i do this, please advise me

Thanks
Ganesh

Masudur
7/26/2007 12:00:00 AM
[quoted text, click to view]

hi...

check wheither your datagrid's row count is zero or not... and then
switch your detailview controls defaultmode to insert...

if (GridView1.Rows.Count==0)
{
DetailsView1.DefaultMode = DetailsViewMode.Insert;
}

Thanks
Md. Masudur Rahman (Munna)
Kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
AddThis Social Bookmark Button