Hi,
I am new to Entity framework 4.0 combine with telerik and I want your help please. I have a grid which is bind to Users entity. All users are assigned to a role (administrator,manager....e.t.c). The relation is many to one. On the grid I manage to displayed the users with all the necessary information including the roles. The user role is displayed inside the grid having a radcombobox and using a separate entitydatasource to fetch all the availble roles exists in database.
- My first problem is that the "role" comboBox doesn't select the correct value each user has during grid load(the first item is always selected).
- Second main problem is that if I want to update a record no changes are applied to the selected record(nothing happens).
Sample code below:
Can you provide me an example using entity framework with grid having many to one relation records. I can't find any examples.
Thanks in advance
I am new to Entity framework 4.0 combine with telerik and I want your help please. I have a grid which is bind to Users entity. All users are assigned to a role (administrator,manager....e.t.c). The relation is many to one. On the grid I manage to displayed the users with all the necessary information including the roles. The user role is displayed inside the grid having a radcombobox and using a separate entitydatasource to fetch all the availble roles exists in database.
- My first problem is that the "role" comboBox doesn't select the correct value each user has during grid load(the first item is always selected).
- Second main problem is that if I want to update a record no changes are applied to the selected record(nothing happens).
Sample code below:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" AllowAutomaticDeletes="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" DataSourceID="EntityDataSource1"> <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="EntityDataSource1" CommandItemDisplay="Top"> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="NAME" FilterControlAltText="Filter NAME column" HeaderText="NAME" SortExpression="NAME" UniqueName="NAME"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="SURNAME" FilterControlAltText="Filter SURNAME column" HeaderText="SURNAME" SortExpression="SURNAME" UniqueName="SURNAME"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="ROLE_ID" DataType="System.Int32" FilterControlAltText="Filter ROLE_ID column" HeaderText="ROLE_ID" SortExpression="ROLE_ID" UniqueName="ROLE_ID"> <EditItemTemplate> <asp:EntityDataSource ID="roleDS" runat="server" ConnectionString="name=TestDbEntities" DefaultContainerName="TESTDbEntities" EnableFlattening="False" EntitySetName="ROLE" Select="it.[ID], it.[NAME]"> </asp:EntityDataSource> <telerik:RadComboBox ID="ROLE_IDComboBox" runat="server" DataSourceID="RoleDS" DataTextField="NAME" DataValueField="ID"> </telerik:RadComboBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="ROLE_IDLabel" runat="server" Text='<%# Eval("ROLE_ID") %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> </MasterTableView> <FilterMenu EnableImageSprites="False"></FilterMenu> <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu></telerik:RadGrid> <asp:EntityDataSource ID="EntityDataSource1" runat="server"ConnectionString="name=TestDbEntities" DefaultContainerName="TESTDbEntities"EnableDelete="True" EnableFlattening="False" EnableInsert="True"EnableUpdate="True" EntitySetName="USER"></asp:EntityDataSource>Can you provide me an example using entity framework with grid having many to one relation records. I can't find any examples.
Thanks in advance