Without using gridview..
'Add following Namespace
using system.data;
using syste.data.sqlclient;
'Write on delete buttons click event
string query = "delete from tablename where primarykeycolumnname = value";
SQLConnection con = new sqlConnection('your connection string);
SQLCommand cmd = new SQLCommand(query, con);
try
{
con.Open();
cmd.ExecuteNonQuery();
}
catch
{
'Handle Exception
}
finally
{
con.Close();
}
and for gridview write the above code in the rowdeleting event
but the primarykeyvalue in the query will come from the follwing code
first of all set the datakeys properties of the gridview to primary key value
and now access the same for eg say ID is the primary key
so you can get its value in rowdeletingevent as
int value = gridview1.Items[gridview1.selectedIndex].value.tostring();
following the code above