I think I'm missing something really basic here.
I have an entity gridview bound to a typed datasource- this is the generated admin page using 13/Nov/06 nightly templates. The entity has multiple foreign keyed relations. Nothing happens when I select delete. Its obviously choking on the foreign key colections. So my question is how do I perform a delete from an entitygridview- along with any FK relations. The only changes i have made to the generated code is I removed some of the bound columns to better suit the admin interface.
Thanks
Ben
Code follows:
<data:GridViewSearchPanel runat ="server" ID="SearchPanel" GridViewControlID="GridView1" BusinessEntityType="FTS.Entities.Hotels" />
<data:EntityGridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
OnSelectedIndexChanged="GridView_SelectedIndexChanged"
DataSourceID="HotelsDataSource"
DataKeyNames="HotelID"
AllowMultiColumnSorting="false"
DefaultSortColumnName=""
DefaultSortDirection="Ascending"
ExcelExportFileName="Export_Hotels.xls"
AllowExportToExcel="true"
>
<Columns>
<asp:CommandField ShowSelectButton="True" ShowEditButton="True" showDeleteButton="true" />
<asp:BoundField DataField="HotelName" HeaderText="HotelName" SortExpression="HotelName" />
<asp:BoundField DataField="HotelCode" HeaderText="HotelCode" SortExpression="HotelCode" />
<asp:TemplateField HeaderText="DestinationID">
<ItemTemplate>
<asp:Repeater ID="DestinationID1" runat="server" DataSourceID="DestinationsFilter1">
<ItemTemplate>
<%# Eval("DestinationName") %>
</ItemTemplate>
</asp:Repeater>
<data:EntityDataSourceFilter ID="DestinationsFilter1" runat="server"
DataSourceID="DestinationsDataSource1"
Filter='<%# String.Format("DestinationID = {0}", Eval("DestinationID")) %>'
/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="HotelRating" HeaderText="HotelRating" SortExpression="HotelRating" />
<asp:checkboxfield DataField="IsLive" HeaderText="IsLive" SortExpression="IsLive" />
<asp:checkboxfield DataField="FeatureOnHomePage" HeaderText="FeatureOnHomePage" SortExpression="FeatureOnHomePage" />
</Columns>
<EmptyDataTemplate>
<b>No Hotels Found!</b>
</EmptyDataTemplate>
</data:EntityGridView>
<br />
<asp:Button runat="server" ID="btnHotels" OnClientClick="BLOCKED SCRIPTlocation.href='/FTS/admin/HotelsEdit.aspx'; return false;" Text="Add New"></asp:Button>
<data:DestinationsDataSource ID="DestinationsDataSource1" runat="server"
SelectMethod="GetAll"
/>
<data:MetrosDataSource ID="MetrosDataSource2" runat="server"
SelectMethod="GetAll"
/>
<data:MetrosDataSource ID="MetrosDataSource3" runat="server"
SelectMethod="GetAll"
/>
<data:HotelsDataSource ID="HotelsDataSource" runat="server"
SelectMethod="GetPaged"
EnablePaging="True"
EnableSorting="True"
>
<Parameters>
<data:CustomParameter Name="WhereClause" Value="" ConvertEmptyStringToNull="false" />
<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
<asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex" Type="Int32" />
<asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize" Type="Int32" />
<data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
</Parameters>
</data:HotelsDataSource>