Got a gridview bound to a LinqDataSource which is getting its data from a MsSQL database view.
This view is pulling in various tables to produce the list I want. This is all working fine.
However, I cannot delete, when I try and use delete I get the error message: Can't perform Create, Update, or Delete operations on 'Table(vwMyView)' because it has no primary key. Well there are a number of tables in there that do have primary keys and I've set the GridView to the DatakeyName I'd like to use in this case 'inID'.
My LDS looks like this:
<asp:LinqDataSource runat="server" ID="ldsMain" EnableDelete="True" ContextTypeName="MyCode.Classes.Data.MyDataContext" OrderBy="inFirstName" OnDeleting="ldsMain_OnDeleting" TableName="MyView"></asp:LinqDataSource>
Have even tried removing the OnDeleting.
I need it to delete direct from the main table which would MyTable and not the View, so how can I do this?