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...


Dorababu MekaRank #457 · 5.5K reputationPosted Jan 3, 2013, 12:51 AM EST
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
}
Neha SharmaRank #569 · 4.3K reputationPosted Jan 3, 2013, 12:55 AM EST
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.
Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 3, 2013, 3:04 AM EST
sathish kumar115 reputationPosted Jan 3, 2013, 3:39 AM EST
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................
}