An item with the same key has already been added

2 posts, 0 answers
  1. Bobby
    Bobby avatar
    1 posts
    Member since:
    Aug 2015

    Posted 05 Aug 2015 Link to this post

    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

  2. Viktor Tachev
    Viktor Tachev avatar
    2466 posts

    Posted 10 Aug 2015 Link to this post

    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
Back to Top