Gridview Exception 2011 Q2

8 posts, 0 answers
  1. Peter Avritch
    Peter Avritch avatar
    7 posts
    Member since:
    Oct 2006

    Posted 13 Jul 2011 Link to this post

    Just updated our stable app to Gridview 2011 Q2 and upon testing found that if you click on non-editable grid cells (giving them focus) and then press the Enter key, it throws an exception.

    I have gone back and verified that with 2011 Q1, the same procedure results in the selected row changing to the next row - as it always has.

    Our app uses several dozen GridViews. This problem existed with most of the ones I tried.

    Peter
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 14 Jul 2011 Link to this post

    Hello,

    Can you post the exception stacktrace? 

    Kind regards,
    Vlad
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. Peter Avritch
    Peter Avritch avatar
    7 posts
    Member since:
    Oct 2006

    Posted 19 Jul 2011 Link to this post

    Hello,

    I apologize for the delay in getting this stack trace to you -

    This is using the official 2011 Q2 release - not any internal builds.
    We have not made any changes to this code in nearly a year and it's worked through all other Telerik releases.

    Failed to compare two elements in the array.

       at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
       at System.Array.BinarySearch[T](T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
       at System.Collections.Generic.List`1.BinarySearch(Int32 index, Int32 count, T item, IComparer`1 comparer)
       at Telerik.Windows.Data.KeyedCollection.IndexOf(Object value)
       at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
       at Telerik.Windows.Data.QueryableCollectionView.IndexOf(Object item)
       at Telerik.Windows.Data.QueryableCollectionView.Contains(Object item)
       at Telerik.Windows.Data.DataItemCollection.Contains(Object value)
       at Telerik.Windows.Controls.GridView.GridViewDataControl.CanActivateRowExecute(Object sender, CanExecuteRoutedEventArgs e)
       at Telerik.Windows.Controls.CommandBinding.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
       at Telerik.Windows.Controls.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
       at Telerik.Windows.Controls.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
       at Telerik.Windows.Controls.CommandManager.OnCanExecute(Object sender, CanExecuteRoutedEventArgs e)
       at Telerik.Windows.Controls.CanExecuteRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
       at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
       at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
       at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
       at Telerik.Windows.Controls.RoutedCommand.CanExecute(Object parameter, UIElement target)
       at Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand()
       at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e)
       at System.Windows.Controls.Control.OnKeyDown(Control ctrl, EventArgs e)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)


    This is the XAML for the GridView.
    If I click on a cell with text in it (such as State), it gets focus even though the cell is read only in this case. Then if I press the Enter key I get the exception listed above. I have tried this with 2011 Q1 and the selection moves to the next row - which is normal.


            <telerikGrid:RadGridView Name="serviceAreasGrid" Grid.Row="1" Margin="0"
                                     Style="{StaticResource ExtendedGridViewStyle}" ColumnWidth="*"
                                     SelectionChanged="gridSelectionChanged"
                                     >
                <telerikGrid:RadGridView.Columns>
                    <telerikGrid:GridViewDataColumn Header="City or Area" MinWidth="70" IsReadOnly="True" DataMemberBinding="{Binding City, Mode=TwoWay}" />
                    <telerikGrid:GridViewDataColumn Header="State" MinWidth="60" IsReadOnly="True" DataMemberBinding="{Binding State, Mode=TwoWay}" />
                    <telerikGrid:GridViewDataColumn Header="Postal Code" MinWidth="70" IsReadOnly="True" DataMemberBinding="{Binding PostalCode, Mode=TwoWay}" />
                    <telerikGrid:GridViewColumn Width="32" IsResizable="False">
                        <telerikGrid:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Button x:Name="EditButton" Style="{StaticResource EditButtonStyle}" Click="editClick" />
                            </DataTemplate>
                        </telerikGrid:GridViewColumn.CellTemplate>
                    </telerikGrid:GridViewColumn>
                    <telerikGrid:GridViewColumn Width="32" IsResizable="False">
                        <telerikGrid:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Button x:Name="DeleteButton" Style="{StaticResource DeleteButtonStyle}" Click="deleteClick" />
                            </DataTemplate>
                        </telerikGrid:GridViewColumn.CellTemplate>
                    </telerikGrid:GridViewColumn>
                </telerikGrid:RadGridView.Columns>
            </telerikGrid:RadGridView> 



    The gridview is loaded with data from a WCF RIA Service - nothing unusual. Here are the fields from the generated file just to give you a feel. It's a simple data-only class with 6 public properties.

        /// <summary>
        /// The 'WebsiteServiceArea' entity class.
        /// </summary>
        [DataContract(Namespace="http://schemas.datacontract.org/2004/07/Gen4.RIA.Web")]
        public sealed partial class WebsiteServiceArea : Entity
        {
           
            private string _city;
           
            private int _position;
           
            private string _postalCode;
           
            private int _serviceAreaID;
           
            private string _state;
           
            private int _websiteID;


    This is the backing code which loads the gridview from the WCF RIA Service:
    BTW- I just did another test whereby I loaded the Svc.WebsiteServiceAreas collection directly into the GridView (bypassing using QueryableCollectionView) and the exception does not happen.

     

     

     

    QueryableCollectionView view = new QueryableCollectionView(Svc.WebsiteServiceAreas);

     

    view.SortDescriptors.Add(

     

    new Telerik.Windows.Data.SortDescriptor()

     

    {

        Member =

     

    "Position",

     

        SortDirection = System.ComponentModel.

     

    ListSortDirection.Ascending

     

    });

    serviceAreasGrid.ItemsSource = view;

  4. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 22 Jul 2011 Link to this post

    Hi Peter Avritch,

    Thank you for the feedback.
    We are aware of this issue and it has been logged as a bug. We will do our best to address it in one of the next internal builds.

    Excuse us for the inconvenience caused.
     
    Best wishes,
    Yordanka
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  5. Peter Avritch
    Peter Avritch avatar
    7 posts
    Member since:
    Oct 2006

    Posted 26 Jul 2011 Link to this post

    Thank you. I just tried 7/25 hotfix and it's still there. Hopefully it will make the next hotfix.

    Peter
  6. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 28 Jul 2011 Link to this post

    Hello Peter Avritch,

    The issue will be fixed with the next internal build.
    Sorry for the inconvenience caused.

    Kind regards,
    Nedyalko Nikolov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  7. Darren
    Darren avatar
    8 posts
    Member since:
    Apr 2011

    Posted 29 Sep 2011 Link to this post

    Is there a temporary workaround for this as it's a pretty major problem.

    EDIT. Nevermind I will use the internal build
  8. Jonathon
    Jonathon avatar
    50 posts
    Member since:
    Aug 2011

    Posted 05 Dec 2011 Link to this post

    Hi,

    I am still getting the same exception in the latest release. When will this be fixed? I get this error when I am trying to add a row to the GridView when the GridView is sorted. When it is not sorted I am able to add a new row to the GridView.

    Thanks,

    Jonathon

    [EDIT]

    My GridView is a collection of IActivitym which is an interface that 3 classes implement. The error message states:

    "Failed to compare two elements in the array.

    Unable to cast object of type 'FirstViewModel' to type 'SecondViewModel'." even though they both implement the same interface. This only happens when the grid is sorted.
Back to Top