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.
Unfortunately, activation email could not send to your email. Please try again.

Html.EJ().Grid excel filter and export error with ForeignKeyField

Thread ID:

Created:

Updated:

Platform:

Replies:

123195 Feb 24,2016 07:29 PM Feb 25,2016 07:32 AM ASP.NET MVC 1
loading
Tags: Grid
bniasoff
Asked On February 24, 2016 07:29 PM

I have a problem with Html.EJ().Grid control, when i have a column with ForeignKeyField and i use the filter '.FilterType(FilterType.Excel)', so when i try to run the filter for that column i get a Javascript runtime error as i show in the picture ExcelFilterError.jpg in the attachment, a different columns filters well. Another issue is when i try to to export to an excel file which include  a column with ForeignKeyField i get an error 'object reference not set to an instance of an object.', if i comment out that column then it exports without issue.

Attachment: Errors_9d9b7dbb.rar

Gowthami V [Syncfusion]
Replied On February 25, 2016 07:32 AM

Hi bniasoff,

Thanks for using Syncfusion products.

Query 1:  i use the filter '.FilterType(FilterType.Excel)', so when i try to run the filter for that column i get a Javascript runtime error

We have analyzed your issue and we are unable to reproduce the issue.

Please provide below details to reproduce the issue.

1.     Share the code example of grid rendering code.

2.     Reproduce the reported issue in the below sample.

3.     Share the product version details.

The provided information will help to analyze  the issue and provide you the response as early as possible.

Query 2: when i try to to export to an excel file which include  a column with ForeignKeyField i get an error 'object reference not set to an instance of an object.',

We can achieve your requirement “Exporting the grid with Foreignkey field” by set the DataSource for the foreignkey column externally in server side.

Refer to the below code example,

public void ExportToExcel(string GridModel)
        {
. . . .

obj.Columns[2].DataSource = new DataClasses1DataContext().Employees.ToList();

            exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
        }


For your convenience we have created a sample and the same can be downloaded from the following link,

http://www.syncfusion.com/downloads/support/directtrac/123196/MVCAPP~31101534944.ZIP

Regards,

Gowthami V.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;