[CLOSED] Exporting Attachment from DirectMethod

  1. #1

    [CLOSED] Exporting Attachment from DirectMethod

    I have a *DirectEvent* that exports an XML representation of a data grid as an attachment (on the HTTP response) and works perfectly.

    I've tried to create a *DirectMethod* that does the same thing, but it does not export the data. At the end, it throws an

    "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"

    exception which is caught in ResourceManager.cs when the directMethod is invoked on Raising the postback event.

    Is this because I am doing a Response.Write in a DirectMethod, which is an Ajax call? And if so, do you recommend that I not use DirectMethods when exporting an attachment?

    Thanks!
    Last edited by Baidaly; Jul 22, 2013 at 6:59 PM. Reason: [CLOSED]
  2. #2
    Hi @ptrourke,

    There is no a big difference between DirectEvents and DirectMethods. The second one is a sub-class of the first one and designed to be conveniently called in JavaScript.

    You might need to set up
    isUpload: true
    for a DirectMethod's config.

    If it doesn't help, please demonstrate a DirectEvent which works and a DirectMethod call which doesn't.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @ptrourke,

    There is no a big difference between DirectEvents and DirectMethods. The second one is a sub-class of the first one and designed to be conveniently called in JavaScript.

    You might need to set up
    isUpload: true
    for a DirectMethod's config.

    If it doesn't help, please demonstrate a DirectEvent which works and a DirectMethod call which doesn't.
    Changing
    App.direct.ExportReports(FiscalYear, StartYear, EndYear)
    to
    App.direct.ExportReports(FiscalYear, StartYear, EndYear, {isUpload: true})
    fixed the problem.

    Please feel free to close the thread (unless you have a spare moment to explain what we just did here or post a link ...).

    Thanks!
  4. #4
    PS: I have just now noticed the threads on "Excel not generated by Direct Event" and "DirectEventConfig IsUpload export to excel", either of which would, if read carefully, have answered my question. Sorry, I missed those.

    Quote Originally Posted by ptrourke View Post
    Changing
    App.direct.ExportReports(FiscalYear, StartYear, EndYear)
    to
    App.direct.ExportReports(FiscalYear, StartYear, EndYear, {isUpload: true})
    fixed the problem.

    Thanks!
  5. #5
    No problem, it is often not so easy to find exactly what you need. Nonetheless, the forums searching really rocks:)

Similar Threads

  1. Replies: 6
    Last Post: Aug 28, 2013, 1:58 PM
  2. BottomBar attachment
    By cwolcott in forum 2.x Help
    Replies: 2
    Last Post: Mar 21, 2012, 2:20 PM
  3. exporting to excel with gridfilters on
    By norphos in forum 1.x Help
    Replies: 0
    Last Post: Oct 18, 2011, 1:14 PM
  4. Replies: 0
    Last Post: Apr 05, 2011, 4:18 AM
  5. [CLOSED] How to realize the form panel style as the attachment picture?
    By csssi_coolite in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 01, 2011, 9:01 AM

Tags for this Thread

Posting Permissions