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

[Solved] ExcelML Null Reference Caused by Invalid Binding from UniqueName

1 Answer 132 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan Morgan
Top achievements
Rank 1
Ryan Morgan asked on 07 Oct 2009, 05:57 AM

There is an inconsistency in how the ToExcel handles binding errors versus how the toCSV and ToHTML handle them.

If you enter a UniqueName for a Grid Column, but it does not map to a field on the data source, this code works:

 

content = grid.ToHtml(true );

 

content = grid.ToCsv(true );

This code does not:

 

content = grid.ToExcelML(

true );

 


After digging a little deeper, I manually entered the code that was passing
        --> content = grid.ToHtml(true );
and I saw in the output window that before the content, there is a notification for each row that had a binding error.

System.Windows.Data Error: BindingExpression path error: 'XXX' property not found on XXX



The ExcelML code simply throws an unhandled exception.
========================================================

{System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Data.TypeExtensions.IsNullableType(Type type)
   at Telerik.Windows.Data.TypeExtensions.GetNonNullableType(Type type)
   at Telerik.Windows.Data.TypeExtensions.GetNumericTypeKind(Type type)
   at Telerik.Windows.Data.TypeExtensions.IsNumericType(Type type)
   at Telerik.Windows.Controls.ExportExtensions.GetExcelMLType(Type type)
   at Telerik.Windows.Controls.ExportExtensions.GetRowValues(GridViewDataControl source, IList`1 records, StringBuilder& builder, ExportFormat format)
   at Telerik.Windows.Controls.ExportExtensions.ToExcelML(GridViewDataControl source, IList`1 records, Boolean includeHeader)
   at Telerik.Windows.Controls.ExportExtensions.ToExcelML(GridViewDataControl source, Boolean includeHeader)
   at MyApp.Silverlight.MainPage.ExportGridDataButton_Click(Object sender, RoutedEventArgs e)}

========================================================

This may be the same issue the person reported about ExcelML here:
http://www.telerik.com/community/forums/silverlight/gridview/toexcelml-null-reference.aspx

Thanks,

Ryan Morgan
www.ArrowDesigns.com

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 13 Oct 2009, 05:56 AM
Hi Ryan,

Sorry for the late reply. We will fix this for our official Q3 release for sure!

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Ryan Morgan
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or