Hello i am using the drag and drop to move rows in a grid
It works fine until i select a row and replace it exactly at the same place.
WHen I do this, i have the following error
Uncaught Error: System.ArgumentOutOfRangeException: Index was out of
range. Must be non-negative and less than the size of the collection.
(Parameter 'index')
Even if i comment my methods, remove the drop, select, deselect method I got the error.
I have no idea where it comes from
Here is a sample code
<SfGrid ID="segmentGrid" DataSource="@GridDataSegment" Toolbar="@(new List<string>() { "Search" })" AllowSelection="true" AllowRowDragAndDrop="true" AllowSorting="true" @ref="@gridSegment">
<GridPageSettings PageSize="5"></GridPageSettings>
<GridEvents RowSelected="RowSelectHandlerSegment" RowDeselected="RowDeselectHandlerSegment" RowDropped="RowSegmentDrop" TValue="Segment"></GridEvents>
<GridSortSettings>
<GridSortColumns>
<GridSortColumn Field="SegmentPriority" Direction="SortDirection.Ascending"></GridSortColumn>
</GridSortColumns>
</GridSortSettings>
<GridColumns>
<GridColumn Field=@nameof(Segment.SegmentId) HeaderText="Segment ID" TextAlign="TextAlign.Right" Width="120" IsPrimaryKey="true"></GridColumn>
<GridColumn Field=@nameof(Segment.SegmentPriority) HeaderText="Priority" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Segment.SegmentCode) HeaderText="Segment Code" Width="150"></GridColumn>
<GridColumn Field=@nameof(Segment.SegmentDescription) HeaderText="Description" TextAlign="TextAlign.Right" Width="200"></GridColumn>
<GridColumn Field=@nameof(Segment.SegmentSQL) HeaderText="SQL Request" TextAlign="TextAlign.Right" Width="250"></GridColumn>
</GridColumns>
</SfGrid>