We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid Not Exporting

I am using version 13.4.0.58

We are looping through data from the viewbag & adding it to the grid, this seems to cause an error  ({"Object reference not set to an instance of an object."} when exporting

Please Advise,

Thank you.

5 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team October 3, 2016 01:20 PM UTC

Hi Avi, 

When the columns bound to the Grid are not defined in the Grid dataSource, the reported issue may occur. We have already discussed about this in the following KB. 


We have prepared a sample that can be downloaded from the following location. 


If you are still facing any issue, please provide the following details to analyze the issue and provide you solution as early as possible. 

1)      Code example of Grid as well as Code behind 
2)      Complete stack trace of the exception 
3)      If possible, replicate the issue in the attached sample and send to us 

Regards, 
Seeni Sakthi Kumar S. 



AS Avi Segal October 7, 2016 08:41 AM UTC

Hi,

We are looping through an array in the rows & are using the dot notation as advised, this works for displaying the data but causes an error on export.

This is the code:

  Dim i As Integer = 0
                                                                                                                                                                                                                                                                                                                    For Each lid In LocationIDs
                                                                                                                                                                                                                                                                                                                        column.HeaderText(LocationNames(lid)) _
                                                                                                                                                                                                                                                                                                                        .Column(Sub(col)
                                                                                                                                                                                                                                                                                                                                    col.Add("Levels." & i & ".Level")
                                                                                                                                                                                                                                                                                                                                    If FBALocationIDs.Contains(lid) Then
                                                                                                                                                                                                                                                                                                                                        col.Add("Levels." & i & ".Inbound")
                                                                                                                                                                                                                                                                                                                                        col.Add("Levels." & i & ".Processing")
                                                                                                                                                                                                                                                                                                                                        col.Add("Levels." & i & ".Fulfillable")
                                                                                                                                                                                                                                                                                                                                        col.Add("Levels." & i & ".Unsellable")
                                                                                                                                                                                                                                                                                                                            End Sub).Add()
                                                                                                                                                                                                                                                                                                                        i += 1
                                                                                                                                                                                                                                                                                                                    Next



Thanks.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team October 10, 2016 11:03 AM UTC

Hi Avi, 

We are unable to reproduce the problem at our end with the provided information. We have also prepared a sample in the VB that can be downloaded from the following location. 


We could also see Columns Syntax is incorrect in your code snippets. Please define the column name in the “Field“ property of Grid Columns. 

Refer to the following code example. 

    Dim gridbuilder = Html.EJ().Grid(Of Object)("SampleGrid") 
    gridbuilder.Datasource(DirectCast(ViewBag.datasource, IEnumerable(Of [Object]))) 
    gridbuilder.AllowPaging()    'Paging Enabled 
       . ..  
            . ..  
    gridbuilder.Columns( 
    Sub(col) 
             
            col.Field("OrderID").HeaderText("Order ID").Add() 
            col.Field("EmployeeID").HeaderText("Employee ID").Add() 
            col.Field("CustomerID").HeaderText("Customer ID").Add() 
            .. .  
                . . 
    End Sub) 
 
    gridbuilder.Render() 


Please share the following information along with the information request in our previous update to analyze the issue and provide you solution as early as possible. 

1)      Complete Stacktrace of the exception 
2)      Code example of the entire Grid and Code behind 
3)      You have quoted that you are looping through the data for assigning the DataSource to the Grid. For exporting, how the dataSource has been assigned to the Export public method. 

Regards, 
Seeni Sakthi Kumar S. 



AS Avi Segal October 10, 2016 04:14 PM UTC

Hi,

See attached example, the error is caused when exporting.

Thanks,

Attachment: MvcApplication66ExportError_bdf85e7e.zip


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team October 11, 2016 11:58 AM UTC

Hi Avi, 

We are able to reproduce the problem at our end. You are trying to export a Complex array Object which is not supported by Grid. So we have considered your requirement as a feature. To track this feature, we have created an incident under your DirectTrac account. Please log on to our support website to check for further updates. 


Regards, 
Seeni Sakthi Kumar S. 


Loader.
Live Chat Icon For mobile
Up arrow icon