I have created a template field for button in grid view with name delete. when I pressed that button i want that particular file to be deleted from grid view and that file has to be stored in the database (.mdf) also. please help me how to do?
thanks in advance...

sathish kumarPosted Jan 3, 2013, 8:39 AM
GridRow-Deleting(string tid, string taskname, string details)
{
string strtid=GridView1.DataKeys[e.RowIndex].Values["tid"].tosting();
string strtname=GridView1.DataKeys[e.RowIndex].Values["tname"].tosting();
string strDetails=GridView1.DataKeys[e.RowIndex].Values["tdetails"].tosting();
//Delete operation
delete from tablename where tid='"+strtid+"' and tname='"+strtname+"'
cmd.executeNonqury();
//Insert operation
insert into table(tid,tname,Details) values('"+strtid+"','"+strtname+"','"+strDetails+"');
cmd.executeNonqury();
check with using Break point...
Hope u can do now................
}
Satyapriya NayakPosted Jan 3, 2013, 8:04 AM
Neha SharmaPosted Jan 3, 2013, 5:55 AM
On the click of delete you can make the status of data 0 or 1 or whatever you like and after deletion data ll remain in table and to bind gridview use data which status is 1.
Note:
0 - not active
1 - active
may be it ll help you.
Dorababu MekaPosted Jan 3, 2013, 5:51 AM
protected void delete()
{
get the row details of which you would like to insert to the table
insert the details to that table
perform delete operation after your insert got executed
}