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
close icon

Grid Export - export URL missing controller name

I'm using syncfusion version 15.1.41 (javascript) and 15.1600.0.41 (EJ and EJ Export)When clicking on the export Excel button (or PDF / word) the URL link is /ExportToExcel instead of /MyController/ExportToExcelAny reason or way to control the URL ?

6 Replies

RF Romain Fabbri April 13, 2017 04:48 PM UTC

Here is the controller source code.
Attachment: Ticket1_50fc62fd.zip


MS Mani Sankar Durai Syncfusion Team April 14, 2017 10:39 AM UTC

Hi Romain, 

Thanks for Contacting Syncfusion support. 

We have analyzed your query and we are not able to reproduce the reported issue. We suspect this the route configuration problem in your application. 
So please check whether the controller and action has been configured correctly in startup.cs page. 

app.UseMvc(routes => 
            { 
                routes.MapRoute( 
                    name: "default", 
                    template: "{controller=Home}/{action=Index}/{id?}"); 
                                     
            }); 
                                                                                                                                               
If you still face the issue please get back to us with the following details. 
1.       Share the startup.cs page from your application. 
2.       Share the video of the issue that you have faced. 
The provided information will help us to analyze the issue and provide you the response as early as possible. 
 
Please let us know if you need further assistance. 

Regards, 
Manisankar Durai 



RF Romain Fabbri April 15, 2017 08:09 AM UTC

I've got the same routing pattern.You can see for yourself...How is the URL built ?Attachment: summer_game_2017_95280780.7z


JK Jayaprakash Kamaraj Syncfusion Team April 17, 2017 08:25 AM UTC

Hi Romain, 
 
To overcome this problem, use Mappers of Grid which is used to modify the default routing path during exporting. By using Mappers, you can use any action name on Controller for exporting and the action can be in any controller (Need not to be in Grid View Page Controller). Please refer to the below code example and sample. 
 
<ej-grid id="FlatGrid" allow-paging="true" datasource="ViewBag.dataSource" export-to-excel-action="/Home/ExportToExcel" export-to-pdf-action="/Home/ExportToPdf" > 
     
    <e-toolbar-settings show-toolbar="true" toolbar-items="@(new List<string>() {"excelExport","pdfExport" })" /> 
    <e-edit-settings allow-editing="true" edit-mode="Batch"></e-edit-settings> 
    <e-columns> 
        <e-column field="OrderID" header-text="Order ID" is-primary-key="true" text-align="Right" width="75"></e-column> 
        <e-column field="CustomerID" header-text="Customer ID" width="80"></e-column> 
        <e-column field="EmployeeID" header-text="Employee ID" text-align="Left" width="75"></e-column> 
        <e-column field="Freight" header-text="Freight" format="{0:C2}" text-align=Right width="75"></e-column> 
        <e-column field="ShipCity" header-text="Ship City" width="110"></e-column> 
    </e-columns> 
</ej-grid> 
 

Regards, 
 
Jayaprakash K. 

 



FH Frank Hoogmans June 5, 2017 12:50 PM UTC

I've seen the same issue arise, and think it has to do with default route values.

When I access my url like "/Members/Index", everything works as expected, but if I access it with "/Members" (and thus, using the default Index action which is defined in the routing config), the export buttons lead me to "/ExportToExcel" instead of "/Members/ExportToExcel".




JK Jayaprakash Kamaraj Syncfusion Team June 6, 2017 12:30 PM UTC

Hi Frank, 

The reported issue has occurred since the URL path wasn’t relative in the project. The action name is to be prepended with the controller name in order to avoid the routing issues. Please refer to the below code example and sample. 

 

<ej-grid id="FlatGrid" allow-paging="true" datasource="ViewBag.dataSource" export-to-excel-action="@Url.Action("ExportToExcel","Home")" export-to-pdf-action="@Url.Action("ExportToPdf","Home")" > 
     
    <e-toolbar-settings show-toolbar="true" toolbar-items="@(new List<string>() {"excelExport","pdfExport" })" /> 
    <e-edit-settings allow-editing="true" edit-mode="Batch"></e-edit-settings> 
    <e-columns> 
        <e-column field="OrderID" header-text="Order ID" is-primary-key="true" text-align="Right" width="75"></e-column> 
        <e-column field="CustomerID" header-text="Customer ID" width="80"></e-column> 
        <e-column field="EmployeeID" header-text="Employee ID" text-align="Left" width="75"></e-column> 
        <e-column field="Freight" header-text="Freight" format="{0:C2}" text-align=Right width="75"></e-column> 
        <e-column field="ShipCity" header-text="Ship City" width="110"></e-column> 
    </e-columns> 

</ej-grid> 

 


Regards, 

Jayaprakash K. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon