Hi,
We use the telerik Q 2009 with llblgen pro as #1 O/R mapper and data-access tier generator for .NET.
I create a simple grid directly connected on the entity object via a asp:objectdatasource.
The method select and insert works fine.
But i have a problem with the update method and delete.
For the update and delete method i have the following :
We use the telerik Q 2009 with llblgen pro as #1 O/R mapper and data-access tier generator for .NET.
I create a simple grid directly connected on the entity object via a asp:objectdatasource.
The method select and insert works fine.
But i have a problem with the update method and delete.
For the update and delete method i have the following :
49|error|500|The field 'Id' is read-only and can't be changed.|
If I enable the column Id i don't have any error but the item is not update but created.
I try also to use UpdateCommand Event and UpdateParameters but i received the same error.
Any experience with LLBLgen and Telerik ?
Thanks is advance for your help.
Edwin.
Bellow my code for the Grid :
<telerik:RadGrid ID="GridBranche" runat="server" AutoGenerateColumns="false" PageSize="20" GridLines="None" AllowPaging="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" DataSourceID="_objDataSource" PagerStyle-AlwaysVisible="True" OnItemDeleted="GridBranche_OnItemDeleted"> <PagerStyle Mode="Slider" /> <MasterTableView EditMode="InPlace" CommandItemDisplay="Top" HorizontalAlign="NotSet" AutoGenerateColumns="false" DataKeyNames="Id"> <Columns> <telerik:GridBoundColumn HeaderText="Id" DataField="Id" DataType="System.Int32" SortExpression="Id" UniqueName="BrancheId" ReadOnly="true" /> <telerik:GridBoundColumn HeaderText="Naam" DataField="Name" /> <telerik:GridDropDownColumn HeaderText="Taal" DataField="LanguageId" DataSourceID="_objLanguageSource" DataType="System.Int32" ListValueField="Id" ListTextField="Name" SortExpression="Id" UniqueName="Languages"> </telerik:GridDropDownColumn> <telerik:GridDropDownColumn HeaderText="Land" DataField="CountryId" DataSourceID="_objCountrySource" DataType="System.Int32" ListValueField="Id" ListTextField="Name" SortExpression="Id" UniqueName="Country"> </telerik:GridDropDownColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderText="Bewerken" /> <telerik:GridButtonColumn ConfirmText="Delete this branche?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" HeaderText="Wissen" /> </Columns> <EditFormSettings ColumnNumber="3" CaptionDataField="Name" CaptionFormatString="Aanpassen branche: {0}"> <FormTableItemStyle Wrap="false" /> <FormMainTableStyle GridLines="None" CellPadding="3" BackColor="White" Width="100%" /> <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" /> <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> <EditColumn ButtonType="ImageButton" InsertText="Insert banner type" UpdateText="Update banner type" UniqueName="EditCommandColumn1" CancelText="Cancel edit"> </EditColumn> </EditFormSettings> </MasterTableView> </telerik:RadGrid> <asp:ObjectDataSource ID="_objDataSource" runat="server" InsertMethod="SaveBranche" SelectMethod="GetBranchesForOverview" UpdateMethod="SaveBranche" DeleteMethod="DeleteBranche" TypeName="Adver.Service.Domain.BranchesService" DataObjectTypeName="Adver.Business.EntityClasses.BranchesEntity"> </asp:ObjectDataSource> <asp:ObjectDataSource ID="_objLanguageSource" runat="server" SelectMethod="GetLanguages" TypeName="Adver.Service.Domain.LanguageService"> </asp:ObjectDataSource> <asp:ObjectDataSource ID="_objCountrySource" runat="server" SelectMethod="GetCountries" TypeName="Adver.Service.Domain.CountryService"> </asp:ObjectDataSource>
code for the service layer
public bool SaveBranche(BranchesEntity entity) { if(entity.Id > 0) { entity.IsNew = true; } return repository.SaveBranche(entity); } public bool UpdateBranche(BranchesEntity entity, int id) { entity.Fields[(int)BranchesFieldIndex.Id].ForcedCurrentValueWrite(id); entity.IsNew = false; return repository.SaveBranche(entity); }