OS: XP SP2
Browser: IE7
Telerik: 2008.2.826.20
I have a radgrid with an Heirarchy and get an error when I am editing a parent record if I try and expand the children below it. This error only appears when trying to edit the parent and attempt to expand the children.
1. I Click on the pencil Edit icon on the parent row.This will open the option to alter the Priority number (this is a read only field).
2. While this window is open, click on the + sign used to expand the children grid relating to this info.
3. An error appears:
"There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource."
Code of my Radgrid:
I Stepped through my code on the back end and I have the following method where this error appears:
Since my parentItem.Edit is true, it goes into the if statement and exits the rgGroupInformation_DetailTableDatabind() method. If I comment out this conditional, the radgrid will allow the child grid to expand and show the items. I suspect there has to be a more graceful way to exit this method.
Browser: IE7
Telerik: 2008.2.826.20
I have a radgrid with an Heirarchy and get an error when I am editing a parent record if I try and expand the children below it. This error only appears when trying to edit the parent and attempt to expand the children.
1. I Click on the pencil Edit icon on the parent row.This will open the option to alter the Priority number (this is a read only field).
2. While this window is open, click on the + sign used to expand the children grid relating to this info.
3. An error appears:
"There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource."
Code of my Radgrid:
| <telerik:RadGrid ID="rgGroupInformation" runat="server" AutoGenerateColumns="False" |
| GridLines="None" Skin="Office2007" OnDetailTableDataBind="rgGroupInformation_DetailTableDataBind" |
| OnItemCommand="rgGroupInformation_ItemCommand" OnUpdateCommand="rgGroupInformation_UpdateCommand" |
| AllowPaging="True" Height="100%" Width="860px" OnNeedDataSource="rgGroupInformation_NeedDataSource"> |
| <MasterTableView EditMode="InPlace" DataKeyNames="BatchGroupId"> |
| <DetailTables> |
| <telerik:GridTableView runat="server" DataKeyNames="BatchId,AssignedUserId,DocumentCount" |
| DataMember="GroupDetails" EditMode="InPlace"> |
| <ParentTableRelation> |
| <telerik:GridRelationFields DetailKeyField="BatchGroupId" MasterKeyField="BatchGroupId" /> |
| </ParentTableRelation> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton"> |
| <HeaderStyle Width="8%" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn DataField="CustodianName" HeaderText="Custodian" ReadOnly="True" |
| UniqueName="Custodian"> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn HeaderText="Assigned User" UniqueName="UserName" DataField="UserName"> |
| <EditItemTemplate> |
| <asp:DropDownList ID="UserName" runat="server" DataTextField="UserName" DataValueField="UserId" |
| DataSource='<%#FillddlUserName() %>' OnDataBound="UserName_DataBound"> |
| </asp:DropDownList> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label runat="server" ID="UserName" Text='<%#bind("UserName") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn DataField="Priority" HeaderText="Priority" UniqueName="Priority"> |
| </telerik:GridBoundColumn> |
| <telerik:GridCheckBoxColumn DataField="OnHold" HeaderText="On Hold" UniqueName="OnHold"> |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridBoundColumn DataField="StartDocRange" HeaderText="Start Doc Range" ReadOnly="True" |
| UniqueName="StartDocRange"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="EndDocRange" HeaderText="End Doc Range" ReadOnly="True" |
| UniqueName="EndDocRange"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="DocumentCount" HeaderText="Document Count" UniqueName="DocCount"> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="TemplateColumn1"> |
| <ItemTemplate> |
| <asp:LinkButton ID="imgBtnDelete" runat="server" CausesValidation="False" CommandArgument="" |
| CommandName="DeleteBatch" ForeColor="#044A7E" OnClientClick="javascript:if(!confirm('This action will delete the selected batch. Are you sure?')){return false;}" |
| Text="Delete" /> |
| </ItemTemplate> |
| <HeaderStyle Width="8%" /> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </telerik:GridTableView> |
| </DetailTables> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn Visible="True"> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <%--<telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Edit"> |
| </telerik:GridEditCommandColumn>--%> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton"> |
| <HeaderStyle Width="8%" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn DataField="CriteriaValue" HeaderText="Criteria Value" ReadOnly="True" |
| UniqueName="CriteriaValue"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="BatchCount" HeaderText="Batch Count" ReadOnly="True" |
| UniqueName="BatchCount"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Priority" HeaderText="Priority" UniqueName="Priority" |
| ReadOnly="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridCheckBoxColumn DataField="OnHold" HeaderText="On Hold" UniqueName="OnHold" |
| ReadOnly="false"> |
| <HeaderStyle Width="10%" /> |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridTemplateColumn UniqueName="TemplateColumn1"> |
| <ItemTemplate> |
| <asp:LinkButton ID="imgBtnDelete" runat="server" CausesValidation="False" CommandArgument="" |
| CommandName="Delete" ForeColor="#044A7E" OnClientClick="javascript:if(!confirm('This action will delete the selected batch. Are you sure?')){return false;}" |
| Text="Delete" /> |
| </ItemTemplate> |
| <HeaderStyle Width="8%" /> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <EditFormSettings> |
| <EditColumn UniqueName="EditCommandColumn1"> |
| </EditColumn> |
| </EditFormSettings> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| </MasterTableView> |
| <ClientSettings> |
| <Scrolling AllowScroll="True" UseStaticHeaders="True" /> |
| </ClientSettings> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </FilterMenu> |
| </telerik:RadGrid> |
I Stepped through my code on the back end and I have the following method where this error appears:
| protected void rgGroupInformation_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) |
| { |
| GridDataItem parentItem = e.DetailTableView.ParentItem as GridDataItem; |
| if (parentItem.Edit) |
| { |
| return; |
| } |
| if (e.DetailTableView.DataMember == "GroupDetails") |
| { |
| DataTable batchList = new DataTable("BatchList"); |
| batchList = BindBatchDetailInformation(Convert.ToInt32(lblBatchCriteriaId.Text.Trim())); |
| e.DetailTableView.DataSource = batchList; |
| } |
| } |