我正在尝试Button
在GridView
.
<asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" />
我有一个三层应用程序,我将在此示例中将其组合成一个函数:
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();
}
}
我确定该var deletion
行没有返回我想要的 Linq to SQL 对象。