Hi,
We recently upgraded to the Q2 2011 release (2011.2 712), and we began seeing exceptions from the RadGridView. This didn't happen with 2011.1 315. We're using a workaround, but we're not sure if the workaround has any negative side effects.
Our app has a RadWindow pop-up containing a RadGridView. If the user is in the middle of an edit and they then click our Cancel button to close the RadWindow, the grid throws the following exception:
Our app code is not anywhere in this stack trace, so I don't think it's our bug.
Here is the markup for our grid:
If we remove the read-only columns, the problem goes away.
We found this earlier thread related to read-only columns: http://www.telerik.com/community/forums/silverlight/gridview/error-binding-gridview-to-domaindatasource.aspx. In that thread, Stefan Dobrev suggested suppressing errors from the grid using the following code:
We tried this and it successfully prevents the exception. However, we're not sure if this also might suppress other problems that we'd actually like to know about. (Is this sort of like swallowing all exceptions with an empty 'catch' block? If so, it might hide some other bug.)
Thanks for your help,
Richard
We recently upgraded to the Q2 2011 release (2011.2 712), and we began seeing exceptions from the RadGridView. This didn't happen with 2011.1 315. We're using a workaround, but we're not sure if the workaround has any negative side effects.
Our app has a RadWindow pop-up containing a RadGridView. If the user is in the middle of an edit and they then click our Cancel button to close the RadWindow, the grid throws the following exception:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index at Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseDataErrorEvent(DataErrorEventArgs args) at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitCurrentEdit(GridViewRow gridViewRow) at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformRowEditEnded(GridViewCell currentCell) at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitCellEdit(GridViewCell currentCell, Boolean isLeavingRow) at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitEdit() at Telerik.Windows.Controls.GridView.GridViewCell.HandlePendingEdit() at Telerik.Windows.Controls.GridView.GridViewCell.HandlePendingEditOnLostFocus() at Telerik.Windows.Controls.GridView.GridViewCell.OnLostFocus(RoutedEventArgs e) at System.Windows.Controls.Control.OnLostFocus(Control ctrl, EventArgs e) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName) |
Our app code is not anywhere in this stack trace, so I don't think it's our bug.
Here is the markup for our grid:
<
telerik:RadGridView
Grid.Row
=
"5"
Grid.Column
=
"2"
Grid.ColumnSpan
=
"2"
x:Name
=
"gvUnderlyingGroupSymbols"
ItemsSource
=
"{Binding UnderlyingGroupSymbols}"
AutoGenerateColumns
=
"False"
AlternationCount
=
"2"
ShowGroupPanel
=
"False"
SelectionMode
=
"Extended"
TabNavigation
=
"Once"
SelectionChanged
=
"GvUnderlyingGroupSymbols_OnSelectionChanged"
DataLoaded
=
"GvUnderlyingGroupSymbols_DataLoaded"
CanUserFreezeColumns
=
"False"
IsEnabled
=
"{Binding AnUnderlyingGroupIsSelected}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Symbol"
DataMemberBinding
=
"{Binding SymbolCode}"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
Header
=
"Exchange"
DataMemberBinding
=
"{Binding ExchangeCode}"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
Header
=
"Type"
DataMemberBinding
=
"{Binding UnderlyingType}"
IsReadOnly
=
"True"
/>
<
telerik:GridViewComboBoxColumn
Header
=
"Direction"
DataMemberBinding
=
"{Binding Direction, Mode=TwoWay}"
SelectedValueMemberPath
=
"Name"
DisplayMemberPath
=
"Name"
/>
<
telerik:GridViewDataColumn
Header
=
"Max Position"
DataMemberBinding
=
"{Binding MaxPosition}"
DataFormatString
=
"{}{0:N0}"
TextAlignment
=
"Right"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
If we remove the read-only columns, the problem goes away.
We found this earlier thread related to read-only columns: http://www.telerik.com/community/forums/silverlight/gridview/error-binding-gridview-to-domaindatasource.aspx. In that thread, Stefan Dobrev suggested suppressing errors from the grid using the following code:
this
.gridView.DataError += (s, args) => args.Handled =
true
;
We tried this and it successfully prevents the exception. However, we're not sure if this also might suppress other problems that we'd actually like to know about. (Is this sort of like swallowing all exceptions with an empty 'catch' block? If so, it might hide some other bug.)
Thanks for your help,
Richard