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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export Bug

Thread ID:





121404 Dec 10,2015 01:53 PM UTC Dec 14,2015 08:47 AM UTC ASP.NET MVC 3
Tags: Grid
Asked On December 10, 2015 01:53 PM UTC

Hi there,

I have been working on page which contains grid with custom template column at the end.  Today I tried to add the export functionality and I think I have stumble upon a bug (or I have done something wrong).  I have copy pasted the tail end of the chtml file below.  If I commend out the highlighted portion (i.e. custom template column) the export functionality is working otherwise when I click on the button the web page is redirected to  something like http://localhost:2530/ExportToExcel

col.HeaderText("Manage Tasks").AllowFiltering(false).AllowEditing(false)
            .ClientSideEvents(eve => eve.Create("create")))
<br />
    @Html.ActionLink("Add New Project", "Add")

<script type="text/x-jsrender" id="columnTemplate">
    @*In the template column we can get the values of corresponding row.*@
    <a rel='nofollow' href='/ProjectTask/TaskList?projectId={{:ID}}'> Tasks</a> &nbsp;
    <a rel='nofollow' href='/ProjectTask/ProjectGantt?projectId={{:ID}}'> Ghantt</a> &nbsp;
    <a rel='nofollow' href='/Project/ProjectUsers?projectId={{:ID}}'> Resource</a>
<script type="text/x-jsrender" id="idColumnTemplate">
    @*In the template column we can get the values of corresponding row.*@
    <a rel='nofollow' href='/Project/Edit?Id={{:ID}}'> {{:ID}}</a> &nbsp;

    function create(args) {
        var index = $.inArray("dataSource", ej.Grid.prototype.ignoreOnExport);
        ej.Grid.prototype.ignoreOnExport.splice(index, 1);

Balaji Marimuthu [Syncfusion]
Replied On December 11, 2015 08:53 AM UTC

Hi Prasanthan,

Thanks for contacting Syncfusion support.

We have checked with the provided code example and the Exporting is not depend on the template column in Grid.

When we run the Grid/sample from the view page(ex: “/Home/Index”) the export action is redirected properly to the controller action “localhost:2530/Home/ExportToExcel”. But when run the Grid/sample from the controller page (ex: HomeController), export is redirected into the default route “localhost:2530/ExportToExcel” instead of controller action method.

To avoid this issue, we suggest you to use the Mappers in Grid. Refer to the sample and code example as below.
Sample: Exporting-Mappers

Help Document: http://help.syncfusion.com/aspnetmvc/grid/exporting



                .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>






               .Mappers(map => map.ExportToExcelAction("/Home/ExportToExcel")



        .Columns(col =>


            col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();

            col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();


            . . .

            .ClientSideEvents(eve => eve.Create("create")))

Still if you face the issue/ if we misunderstood your requirement could you please share the following details to find the cause of issue and provide you better solution at the earliest?

1.     Share Essential Studio version

2.     Share browser details.

3.     Revert us the attached sample.

Balaji Marimuthu

Replied On December 11, 2015 09:16 AM UTC

Hi Balaji,

Thanks a lot.  Your solution (using mapping) has solved my problem of redirecting.  I can now export into either Excel or PDF files.  I am assuming there won't be any issues if I deploy the solution to Azure environment (both WEB and SQL back-end).

However I have an error occurring if I am trying to export as a word document.  I am suspecting it could be something do with the local assemblies?  I am running Visual studio 2015 and using Syncfusion, C# 4.6.   I am happy with the ability to export into excel (and pdf) it will be nicer to have word working as well but not necessary thought I raise the issue with you

I have copy pasted the error message below.

System.ArgumentOutOfRangeException was unhandled by user code
  Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
       at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
       at System.Collections.Generic.List`1.System.Collections.IList.get_Item(Int32 index)
       at Syncfusion.DocIO.DLS.WCellCollection.get_Item(Int32 index)
       at Syncfusion.EJ.Export.GridWordExport.ExportRecordRow(String value, GridTableCellType style)
       at Syncfusion.EJ.Export.GridWordExport.ProcessColumnHeader(Column column)
       at Syncfusion.EJ.Export.GridWordExport.ProcessHeaderContent()
       at Syncfusion.EJ.Export.GridWordExport.IterateElements()
       at Syncfusion.EJ.Export.GridWordExport.ExportHandler()
       at Syncfusion.EJ.Export.GridWordExport.MultipleColumnExport(Int32 count, Int32 templateColumncount, Int32 hideColumnCount)
       at Syncfusion.EJ.Export.GridWordExport.ExecuteResult(GridProperties GridModel, IEnumerable dataSource)
       at Syncfusion.EJ.Export.GridWordExport.Export(GridProperties gridModel, IEnumerable dataSource, Boolean multipleExport)
       at Syncfusion.EJ.Export.WordExport.Export(GridProperties gridmaodel, IEnumerable datasource, String fileName, Boolean isHideColumnIncude, Boolean isTemplateColumnIclude, Boolean isAutoFit, String theme)
       at Syncfusion.EJ.Export.WordExport.Export(GridProperties gridmaodel, IEnumerable datasource, String fileName, Boolean isHideColumnIncude, Boolean isTemplateColumnIclude, String theme)
       at Syncfusion.EJ.Export.WordExport.Export(GridProperties gridmaodel, IEnumerable datasource, String fileName, Boolean isHideColumnIncude, Boolean isTemplateColumnIclude, ExportTheme theme)
       at Troam.Website.Controllers.ProjectController.ExportToWord(String GridModel) in C:\Data\Software Development\Microsoft\Source\TROAM\Ntri.Troam\Source\Troam.Website\Controllers\ProjectController.cs:line 46
       at lambda_method(Closure , ControllerBase , Object[] )
       at System.Web.Mvc.ActionMethodDispatcher.<>c__DisplayClass1.<WrapVoidAction>b__0(ControllerBase controller, Object[] parameters)
       at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
       at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()


Balaji Marimuthu [Syncfusion]
Replied On December 14, 2015 08:47 AM UTC

Hi Prasanthan,

We have created a sample as mentioned version and checked the reported issue from our end. But we are unable to reproduce the reported issue, so could you please share the following details?

1.     Scenario to reproduce the issue.

2.     Have you enabled any other features in Grid?

3.     Browser version details.

4.     Share sample/modify the attached sample as issue reproducible.

Refer to the sample in following link:

Sample: Exporting

Kindly, provide above details which will be helpful to find the cause of issue and provide you better solution at the earliest.


Balaji Marimuthu


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon