I'm trying implement a simple Button
field in the GridView
.
<asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" />
I have a three-tier application that I'll combine into one function for this example:
protected void GV1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
var deletion = (HRA_internalLesion) GV1.SelectedRow.DataItem;
DataContext conn = new DataContext();
conn.HRA_internalLesions.DeleteOnSubmit(deletion);
conn.SubmitChanges();
}
}
I'm sure the var deletion
line is not returning the Linq to SQL object I want.