Hi,
I have a RadGrid that's bound to EntityDataSource. A few of the columns are bound to navigation properties of the bound entity. When I try to delete a record, it gives the following error:
Error: Sys.WebForms.PageRequestManagerServerErrorException: A property named 'Vehicle.VehicleNo' was not found on the entity during an insert, update, or delete operation. Check to ensure that properties specified as binding expressions are available to the data source.
I know if I choose to use the plain foreign key IDs, instead of the navigation properties, everything works. I can easily get the delete to work if I handle it manually. But I"m just thinking there's got to be a way for the automatic delete to work too. Please advise.
I have a RadGrid that's bound to EntityDataSource. A few of the columns are bound to navigation properties of the bound entity. When I try to delete a record, it gives the following error:
Error: Sys.WebForms.PageRequestManagerServerErrorException: A property named 'Vehicle.VehicleNo' was not found on the entity during an insert, update, or delete operation. Check to ensure that properties specified as binding expressions are available to the data source.
I know if I choose to use the plain foreign key IDs, instead of the navigation properties, everything works. I can easily get the delete to work if I handle it manually. But I"m just thinking there's got to be a way for the automatic delete to work too. Please advise.
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowAutomaticDeletes
=
"True"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
DataSourceID
=
"EntityDataSource1"
GridLines
=
"None"
ShowGroupPanel
=
"True"
Skin
=
"Hay"
OnItemUpdated
=
"RadGrid1_ItemUpdated"
OnItemInserted
=
"RadGrid1_ItemInserted"
OnItemCommand
=
"RadGrid1_ItemCommand"
Height
=
"400px"
Width
=
"700px"
CellSpacing
=
"0"
>
<
MasterTableView
DataKeyNames
=
"ADChecklistId"
DataSourceID
=
"EntityDataSource1"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
AddNewRecordText
=
"Add New Aerial Device Checklist"
ShowRefreshButton
=
"false"
ShowAddNewRecordButton
=
"true"
></
CommandItemSettings
>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
HeaderText
=
"Edit"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
UniqueName
=
"DeleteCommandColumn"
HeaderText
=
"Delete"
ConfirmDialogType
=
"RadWindow"
ConfirmText
=
"Are you sure you want to delete this record?"
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"Vehicle.VehicleNo"
FilterControlAltText
=
"Filter VehicleNo column"
HeaderText
=
"VehicleNo"
SortExpression
=
"Vehicle.VehicleNo"
UniqueName
=
"Vehicle.VehicleNo"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Employee.FirstName"
FilterControlAltText
=
"Filter FirstName column"
HeaderText
=
"FirstName"
SortExpression
=
"Employee.FirstName"
UniqueName
=
"Employee.FirstName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Employee.LastName"
FilterControlAltText
=
"Filter LastName column"
HeaderText
=
"LastName"
SortExpression
=
"Employee.LastName"
UniqueName
=
"Employee.LastName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Utility.UtilityName"
HeaderText
=
"Utility"
SortExpression
=
"Utility.UtilityName"
UniqueName
=
"Utility.UtilityName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"CreatedOn"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter CreatedOn column"
HeaderText
=
"CreatedOn"
SortExpression
=
"CreatedOn"
UniqueName
=
"CreatedOn"
DataFormatString
=
"{0:MM/dd/yy}"
>
</
telerik:GridDateTimeColumn
>
<
telerik:GridBoundColumn
DataField
=
"CreatedBy"
FilterControlAltText
=
"Filter CreatedBy column"
HeaderText
=
"CreatedBy"
SortExpression
=
"CreatedBy"
UniqueName
=
"CreatedBy"
>
</
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"ModifiedOn"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter ModifiedOn column"
HeaderText
=
"ModifiedOn"
SortExpression
=
"ModifiedOn"
UniqueName
=
"ModifiedOn"
DataFormatString
=
"{0:MM/dd/yy}"
>
</
telerik:GridDateTimeColumn
>
<
telerik:GridBoundColumn
DataField
=
"ModifiedBy"
FilterControlAltText
=
"Filter ModifiedBy column"
HeaderText
=
"ModifiedBy"
SortExpression
=
"ModifiedBy"
UniqueName
=
"ModifiedBy"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
AllowDragToGroup
=
"True"
EnablePostBackOnRowClick
=
"true"
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
<
Resizing
AllowColumnResize
=
"true"
ClipCellContentOnResize
=
"false"
/>
</
ClientSettings
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
</
HeaderContextMenu
>
</
telerik:RadGrid
>
<
asp:EntityDataSource
ID
=
"EntityDataSource1"
runat
=
"server"
AutoGenerateWhereClause
=
"True"
ConnectionString
=
"name=MSOpsEntities"
DefaultContainerName
=
"MSOpsEntities"
EnableFlattening
=
"False"
EnableDelete
=
"True"
EntitySetName
=
"ADChecklists"
Include
=
"Vehicle, Employee, Utility"
OrderBy
=
"it.CreatedOn DESC"
OnSelecting
=
"EntityDataSource1_Selecting"
ondeleting
=
"EntityDataSource1_Deleting"
>
<
WhereParameters
>
<
asp:SessionParameter
Name
=
"UtilityId"
SessionField
=
"utilityId"
Type
=
"Int32"
/>
</
WhereParameters
>
</
asp:EntityDataSource
>