This is a migrated thread and some comments may be shown as answers.

An item with the same key has already been added

1 Answer 24 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Bobby asked on 05 Aug 2015, 05:55 PM

I know this has been discussed multiple times in the forum, but unfortunately I was unable to find a solution that was working for me.  So here it is again.  Please someone help! :)

 Here is the code 

<AxnGrids:AxnGrid AllowMultiRowSelection="False" AllowRowClickEventPropagation="True" AllowSorting="True" AutoGenerateColumns="False" 
EnableEmbeddedSkins="False" EnableViewState="True" Height="100%" ID="TimeCardsGrid" InitialResizeToFit="True" 
OnItemDataBound="TimeCardsGrid_OnItemDataBound" OnNeedDataSource="TimeCardsGrid_OnNeedDataSource" runat="server" Skin="TMW_v1" 
<MasterTableView EditMode="EditForms" AllowMultiColumnSorting="True" TableLayout="Auto" EnableColumnsViewState="True" EnableViewState="True" >
<%-- columns returned: empid, emptimeid, startdate, enddate, status, empdrvid, approved --%>
<telerik:GridBoundColumn DataField="TimecardId" HeaderText="Timecard" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="100px" />
<telerik:GridBoundColumn DataField="StartDate" HeaderText="Start Date" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="100px" />
<telerik:GridBoundColumn DataField="EndDate" HeaderText="End Date" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="100px" />
<telerik:GridBoundColumn DataField="Approved" HeaderText="Approved" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="100px" />
<telerik:GridSortExpression FieldName="TimecardId" SortOrder="Descending" />
<ClientEvents OnGridCreating="FixGridSizers" OnRowDblClick="raiseServerCommandRowDblClick" />
<Resizing AllowColumnResize="True" ClipCellContentOnResize="False" />
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="True" EnableVirtualScrollPaging="False" UseStaticHeaders="True" />

When this is run, i get the error "An item with the same key has already been added".  if i comment out the line between the SortExpression, it works fine.

Any suggestions

1 Answer, 1 is accepted

Sort by
Viktor Tachev
Telerik team
answered on 10 Aug 2015, 07:00 AM
Hello Bobby,

From the provided code it seems that you are using an extended RadGrid control. Would you replace it with a regular RadGrid and see if the behavior changes?

If the issue persists please assemble a sample project where the issue is replicated and send it to us. Thus, we can examine the behavior and look for its cause.

Viktor Tachev
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question