public void btnDelete_Clicked(object sender, EventArgs e) { LinkButton lbtnDelete = (LinkButton)sender; Guid itemIdToDelete = new Guid(lbtnDelete.Attributes["itemid"]); MonkData db = new MonkData(); string tableName = ((System.Data.Linq.Mapping.TableAttribute)DataType.GetCustomAttributes(typeof(System.Data.Linq.Mapping.TableAttribute), false).First()).Name; primaryKeyProp = GetPrimaryKeyProperty(DataType); db.ExecuteCommand("DELETE FROM " + tableName + " WHERE " + primaryKeyProp.Name + " = '" + itemIdToDelete.ToString() + "'"); db.SubmitChanges(); }