Hi.
I have a RadComboBox in a GridTemplateColumn's EditTemplate like this:
The Grid uses one EntityDataSource and the combobox another.
This works perfectly when updating existing rows, but when I insert a new row it crashes with:
DataBinding: 'Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'Unit'.
I guess this is because Unit is null when I insert a new object and therefore cant resolve Unit.Id.
All the existing solutions recommend that you cancel the insert command and insert a dummy row, this would work if it was a ordinary column, but since its an entity I have to specify the relation, hence Unit.Id and not UnitId (which is the columnname in the grids entitydatasource)
I suspect this is the same problem that FreshOne reported here: Forum link
Ive also tried to behind selectedvalue code behind (trying to distinguish between update and insert) but then no values get updated instead.
Can I clarify my problem further?
Best Regards
N.
I have a RadComboBox in a GridTemplateColumn's EditTemplate like this:
....
<telerik:GridTemplateColumn UniqueName="Unit.Name" HeaderText="Unit" DataField="Unit.Id" SortExpression="Unit.Id" ItemStyle-Width="250px"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "Unit.Name")%> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox runat="server" ID="UnitComboBox" EnableLoadOnDemand="True" SelectedValue='<%#Bind("Unit.Id")%>' DataTextField="Name" DataSourceID="UnitEntityDataSource" DataValueField="Id" AutoPostBack="true" HighlightTemplatedItems="true" Height="250px" Width="250px" DropDownWidth="600px">
....The Grid uses one EntityDataSource and the combobox another.
This works perfectly when updating existing rows, but when I insert a new row it crashes with:
DataBinding: 'Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'Unit'.
I guess this is because Unit is null when I insert a new object and therefore cant resolve Unit.Id.
All the existing solutions recommend that you cancel the insert command and insert a dummy row, this would work if it was a ordinary column, but since its an entity I have to specify the relation, hence Unit.Id and not UnitId (which is the columnname in the grids entitydatasource)
I suspect this is the same problem that FreshOne reported here: Forum link
Ive also tried to behind selectedvalue code behind (trying to distinguish between update and insert) but then no values get updated instead.
Can I clarify my problem further?
Best Regards
N.