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

Export to CSV - fails with multiple derived types.

2 Answers 25 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 11 Mar 2011, 07:45 PM
If I have a RadGridView bound to

ObservableCollection<X> ItemsSource = new ObservableCollection<X>

where X is an abstract class, and I put only derived Y objects inside, then the grid export to CSV works.  As soon as I put a sibling derived Z object in, the export fails:

Error: An unknown error has occurred.
Detail: System.NullReferenceException
Object reference not set to an instance of an object.
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Type memberType)
   at Telerik.Windows.Data.Expressions.PropertyAccessExpressionBuilder.CreateMemberAccessExpressionOverride()
   at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateMemberAccessExpression()
   at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateLambdaExpression()
   at Telerik.Windows.Data.BindingToExpressionExtensions.CreateMemberAccessLambdaExpression(Binding binding, Type objectType, Type memberType)
   at Telerik.Windows.Data.BindingToExpressionExtensions.CreateUntypedMemberAccessFunc(Binding binding, Type objectType, Type memberType)
   at Telerik.Windows.Data.BindingToExpressionExtensions.CreateMemberAccessFunc(Binding binding, String stringFormat, Type objectType, Type memberType)
   at Telerik.Windows.Controls.GridViewBoundColumnBase.InitializeMemberAccessFunc()
   at Telerik.Windows.Controls.GridViewBoundColumnBase.GetCellContent(Object item)
   at Telerik.Windows.Controls.GridViewExportWriter.RenderDataCells(Object item)
   at Telerik.Windows.Controls.GridViewExportWriter.RenderDataRows(IEnumerable items)
   at Telerik.Windows.Controls.GridViewExportWriter.Render()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.Export(Stream stream, GridViewExportOptions options)
   at Client.GridUtilities.ExportCsv(RadGridView gridView)
   at Client.HomePage.ExportToCsv(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)


Is this a bug? Where should I start looking?

Thanks,
Tim

2 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 12 Mar 2011, 03:15 PM
Hello Tim,

 I believe we encountered a very similar issue some time ago in RadTreeListView, again with multiple types derived from a shared base type. We fixed that bug in a recent version, however. What version of our controls are you using? Could you please try using our 2010 Q3 SP1 assemblies, or even the latest internal build?

All the best,
Yavor Georgiev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Tim
Top achievements
Rank 1
answered on 14 Mar 2011, 03:33 PM
I am using 2010.3.1110.  It appears fixed in 2010.3.1314.

Thanks,
Tim


Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Tim
Top achievements
Rank 1
Share this question
or