Hi,
I'm trying to use a grid to bind to an object data source that receives tis data from EF4.
I run into problems when I try to edit a column that is an associated entity.
I have the following two entities:
Register_App and
App
Register_App is associated to App. Thus Register_App has a property App which in turn has an ID.
I would like to display a dropdown combo so I can select the appropriate App and this infpo is persisted to the
object data source.
I made the following grid column:
<
telerik:GridDropDownColumn
ListTextField
=
"Name"
ListValueField
=
"Id"
DataSourceID
=
"odsApps"
HeaderText
=
"App"
DataField
=
"App.ID"
DropDownControlType
=
"RadComboBox"
></
telerik:GridDropDownColumn
>
It works fine in display mode. The App is bound based on the DataField App.ID, and the correct Name is displayed.
When I turn to edit mode, all is wel again. A combobox is displayed with all the Apps and the correct one is
displayed. When I try to save the data I get the following error:
System.InvalidOperationException: Could not find a property named 'App.ID' on the type specified by the
DataObjectTypeName property in ObjectDataSource 'odsRegApps'. at
System.Web.UI.WebControls.ObjectDataSourceView.BuildDataObject(Type dataObjectType, IDictionary inputParameters) at
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary
oldValues) at System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues,
DataSourceViewOperationCallback callback) at Telerik.Web.UI.GridTableView.PerformUpdate(GridEditableItem
editedItem, Boolean suppressRebind) at Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source)
I am surprised that the property App.ID is resolved in Display mode and Edit mode but not during save. Do you know
what I'm doing wrong?
Any help is greatly appreciated,
best regards,
Chris Vrolijk
P.S. Below I included my entire control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AdminApps.ascx.cs"
Inherits="ActuIT.Futurama.ManagementSite.RegisterAdminAppsControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:ObjectDataSource
ID
=
"odsRegApps"
runat
=
"server"
DataObjectTypeName
=
"ActuIT.Futurama_Vision.EFDataLayer.Register_App"
SelectMethod
=
"GetRegisterApps"
TypeName
=
"ActuIT.Futurama_Vision.Business.Register"
UpdateMethod
=
"UpdateApp"
DeleteMethod
=
"DeleteApp"
InsertMethod
=
"InsertApp"
>
</
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"odsPAs"
runat
=
"server"
DataObjectTypeName
=
"ActuIT.Futurama_Vision.EFDataLayer.Register_PA"
SelectMethod
=
"GetPAs"
TypeName
=
"ActuIT.Futurama_Vision.Business.Register"
></
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"odsPUVs"
runat
=
"server"
DataObjectTypeName
=
"ActuIT.Futurama_Vision.EFDataLayer.Register_PUV"
SelectMethod
=
"GetPUVs"
TypeName
=
"ActuIT.Futurama_Vision.Business.Register"
></
asp:ObjectDataSource
>
<
asp:ObjectDataSource
ID
=
"odsApps"
runat
=
"server"
DataObjectTypeName
=
"ActuIT.Futurama_Vision.EFDataLayer.App"
SelectMethod
=
"GetApps"
TypeName
=
"ActuIT.Futurama_Vision.Business.Vision"
></
asp:ObjectDataSource
>
<
telerik:RadGrid
ID
=
"gridApps"
runat
=
"server"
AllowAutomaticDeletes
=
"True"
AllowPaging
=
"True"
AutoGenerateColumns
=
"True"
AllowAutomaticUpdates
=
"true"
AllowAutomaticInserts
=
"true"
DataSourceID
=
"odsRegApps"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"Id"
DataSourceID
=
"odsRegApps"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
HeaderText
=
"Edit"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
UniqueName
=
"DeleteColumn"
ConfirmText
=
"Are you sure you want to delete this application?"
ConfirmTitle
=
"Confirm Delete"
ConfirmDialogType
=
"Classic"
HeaderText
=
"Delete"
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"Id"
UniqueName
=
"Id"
HeaderText
=
"Register ID"
Visible
=
"true"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Name"
UniqueName
=
"Name"
HeaderText
=
"Naam"
>
</
telerik:GridBoundColumn
>
<
telerik:GridCheckBoxColumn
UniqueName
=
"UseXMLData"
DataField
=
"UseXMLData"
HeaderText
=
"UseXMLData"
/>
<
telerik:GridBoundColumn
ColumnEditorID
=
"txtDocument"
DataField
=
"Document"
UniqueName
=
"Document"
HeaderText
=
"Document"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Folder"
UniqueName
=
"Folder"
HeaderText
=
"Folder"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"WebService"
UniqueName
=
"WebService"
HeaderText
=
"WebService"
>
</
telerik:GridBoundColumn
>
<
telerik:GridDropDownColumn
ListTextField
=
"Name"
ListValueField
=
"Id"
DataSourceID
=
"odsApps"
HeaderText
=
"App"
DataField
=
"App.ID"
DropDownControlType
=
"RadComboBox"
></
telerik:GridDropDownColumn
>
<
telerik:GridDropDownColumn
ListTextField
=
"Code"
ListValueField
=
"Id"
DataSourceID
=
"odsPAs"
HeaderText
=
"PA"
DataField
=
"Register_PA.Id"
DropDownControlType
=
"RadComboBox"
></
telerik:GridDropDownColumn
>
<
telerik:GridDropDownColumn
ListTextField
=
"Code"
ListValueField
=
"Id"
DataSourceID
=
"odsPUVs"
HeaderText
=
"PUV"
DataField
=
"Register_PUV.Id"
DropDownControlType
=
"RadComboBox"
></
telerik:GridDropDownColumn
>
</
Columns
>
<
EditFormSettings
ColumnNumber
=
"2"
CaptionDataField
=
"Name"
InsertCaption
=
"Voeg register applicatie toe"
EditFormType
=
"AutoGenerated"
>
<
EditColumn
InsertText
=
"Insert"
EditText
=
"Edit application id #:"
EditFormColumnIndex
=
"0"
UpdateText
=
"Application updated"
UniqueName
=
"InsertCommandColumn1"
CancelText
=
"Cancel"
ButtonType
=
"ImageButton"
></
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>