Export Service not Working Prpoerly

Posted by: jimmcgoldrick on 7 June 2020, 10:42 pm EST

  • Posted 7 June 2020, 10:42 pm EST

    Dear Sir or Madam:
    I am developing a web site using ASP.Net 4.6.1 and incorporation C1 Graphs and Charts (ver 4.5.20193.322) using Visual Studio 201312.40629.00 upd 5. I am trying to get the ASPNET Export Service working, with rather mixed results. The system is set to export PNG Files from the web page, and I have buttons with the following JavaScript attached:
    <asp:PlaceHolder runat="server">
    <!--Export Methods-->
    <script type="text/javascript">
    $(function () {
    $("#exportImage").click(exportImage);
    });
    function getChart() {

    var Graph = $("#<%=bcKitCount.ClientID%>");

    return Graph;
    }

    // Export function
    function exportImage() {
    var fileName = "LotarTheBonnet";
    var type = "Png";
    var url = "http://demos.componentone.com/ASPNET/ExportService" + "/exportapi/chart";
    var chart = getChart();
    $("#<%=bcKitCount.ClientID%>").c1barchart("exportChart", fileName, type, url);
    }
    </script>
    </asp:PlaceHolder>
    This is pretty close to the example given on the ComponentOne site. The trouble is, on older systems (Windows XP with Internet Explorer 8) it seems to work, prompting you to save in the download folder, or where you like. But in more modern Systems (Win10, Chrome Browser, etc.) it just fails silently, no error, nothing, just a web page postback from the button click.
    The other problem is the url. I use your demo example (as above) and it may work, but when I try to use our own (localhost/exportapi/chart or localhost/ C1ASPNETExportService/exportapi/chart) the system fails, once again without an error. I have the Service installed on IIS (7.0), as per default. Please help.
  • Replied 8 June 2020, 8:49 pm EST

    Hi,
    We are sorry, we are unable to replicate the issue at our end with the build 4.0.20201.326 build version.
    Please refer to the attached sample for reference and call exportChartToImage() method from the console.
    Please check and share your observation.

    Regards,
    Manish Gupta

    C1BarChart_Export_ExportService.zip
  • Replied 8 June 2020, 9:41 pm EST

    Hi Manish
    Thanks kindly for the response. Unfortunately, the sample you sent me refers to an old version of the wijmo library, C1.Web.Wijmo.Controls.4, as you point out, 4.0.20201.326. My system is using C1.Web.Wijmo.Controls.45, Version 4.5.20193.322, and as I am now fully firing on all cylinders with this (after some months of hard travel), I cannot revert. Would you please send me an revised Sample Zip, referring to the up-to-date library, so I can proceed from there. Many thanks.
  • Replied 9 June 2020, 10:33 pm EST

    Hi,
    We have tried with the latest build previous time too but it was with targetted 4.0 net framework for 2020v1 release.
    While you are using 4.5 Net Framework targetted dll for 2019v3 release.

    However, we have tried with 4.5.20201.326 too and the result are same.

    Please find the attached sample for reference:

    Regards,
    Manish Gupta
  • Replied 9 June 2020, 10:35 pm EST

    C1Chart45.zip
  • Replied 11 June 2020, 6:52 pm EST

    This has not helped I'm afraid, so what I think next is I shall try using your libraries, ver 4.5.20201.326 from 2020v1. This unfortunately is a big step and will take me the weekend to transfer over to. Hopefully this move won't introduce any new glitches, and I shall forward you the results soon after Monday.
  • Replied 14 June 2020, 2:12 pm EST

    Hi,
    We have tested the application with 2019v3.322 version too and we are unable to replicate the issue at our end.
    We have tried with the C1 live service and the locally hosted ExportService for version 2019v3.322.
    In both cases, we are unable to replicate the issue. Could you please try to modify the previously attached sample depicting your issue so that we may replicate the issue at our end?

    Regards,
    Manish Gupta
  • Replied 14 June 2020, 7:15 pm EST

    Hi there Manish
    I have set you up a log in to our live web site, which you can reach at: http://chpt.co.uk/kits. At this point, you will be able to gain access using temporary user name “C1” and password “grapecity”. You will then see the Siemens front end page. Among the buttons on the top right of screen is the “Kit Charting Gallery” button, which I want you to press. This takes you to a page with various different graph types on it. Click on the first, blue Bar Chart. This opens a new page with a bar chart titled “Kit Totals”. In the bottom left of this page is a button captioned “Export Image”, which invokes your client routine: "exportChart". Now as you should see, this only responds with a reload of the page in modern browsers. However, it works perfectly well, prompting you to save the png file, in old Internet Explorer 8! I need a solution to this problem, or I am toast. I cannot tell my customer to go back to that - they expect this to work in Safari Mobile on an iPhone 11, for goodness sake! Please help me if you can.
    sincerely
    Jim McGoldrick
  • Replied 15 June 2020, 3:05 pm EST

    Hello Jim,
    We have give it a try and find that on clicking the ExportImage button, an ajax request occurs for GetDataOnLoad() method on GetKitQuantity asmx file which returns the data.
    The same behavior occurs with IE too. Please check at your end.

    Regards,
    Manish Gupta
  • Replied 15 June 2020, 9:09 pm EST

    Hi there Manish
    As you can see, the system does a postback (hence calling GetDataOnLoad(), etc.) when the button is pressed, this being the default behaviour for a form button. I believe it is calling the c1barchart exportChart routine correctly, but then crashes out without throwing an error, and proceeds with its default action instead. You tried it with Internet Explorer with the same results – have you used IE version 8 (ie, circa 2010). If you do I think you will find it works fine, prompting for the file name, then saving at the chosen location before offering to open in the default app for PNG Images (Paint perhaps, or PhotoShop). So too the PDF Export, though it will invoke Acrobat Reader, of course. This is the problem I pointed out in the first place. I need this routine to function in virtually any modern browser, and frustratingly it does not. I have used my own code, yours and the examples from grapecity.com and the results are the same. I have used different .Net frameworks, calls by button clicks and ScriptManager.RegisterStartupScript routines, client and server side, and all I get is a postback. Switch to a stone-age browser, lo, it comes to life and works a treat. Please can you make some enquiries about this and give us a clue to my next step. I never thought this part of the development would be so fraught with difficulties.
    sincerely
    Jim McGoldrick
  • Replied 16 June 2020, 7:08 pm EST

    Hello Manish
    We have made a breakthrough of sorts. The Target Server for our Web Site is a 2008R2 Server Running SQL Server (our source of data) and IIS 7.5 (7.5.7600.16385). This latter seems to be the cause of the download failure. If I install a copy of the site on a system (Win10, it chanced) with IIS 10 (ver. 10.0.18362.1) the Image Exporting works just as expected in a modern browser (take your pick, we tried Edge, Chrome, Safari). This is good, but the trouble is I have no control of the Server, it being the customer’s, and in heavy use hourly from all over the world. They do intend to upgrade to a newer Windows Server (2016 or 2019, perhaps), but what with Covid19, Exiting the EU and the menace of Global Warming, they are unlikely to do so for a couple of years. Can you tell me of any workaround that might coax it to work in the software environment that is imposed on us. I should be most grateful for your ideas.
    Many thanks.
    Jim McGoldrick
  • Marked as Answer

    Replied 16 June 2020, 8:11 pm EST

    Hello Jim,
    We are sorry but in IE, we are also unable to export the image but it keeps waiting for a response.

    We are able to replicate the issue at our end if we call the method on button click which is placed within the form.
    To make it work, we need to add return false after calling the export method to avoid further server calls which reject the previous call.
    Please refer to the following code snippet for reference:
     <button onclick="exportChartToImage();return false;">ExportChart</button>


    Regards,
    Manish Gupta
  • Replied 16 June 2020, 10:20 pm EST

    As you stand in your shoes, may you feel the need to dance a jig or two for my sake! Well done. I remember this trick from years ago; stop the button posting the page by returning false. I must get back to the habit of reading my old notes from time to time, and definitely not throw them away. Shan’t have to go to the client and ask for a remission of this feature, after all. Thanks again, deeply felt,
    Jim McGoldrick
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels