Javascript error when click print function in a RadAjaxPanel

Thread is closed for posting
2 posts, 0 answers
  1. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 17 Apr 2012 Link to this post

    Hi:
    I just placed my working chart inside a RadAjaxPanel and the print functionally is giving me a javascript runtime error on the { before the finally.

    try{a._webRequest.completed(Sys.EventArgs.Empty)}finally{if(a._xmlHttpRequest!=null)

    The JScript message says, it may be caused by response.write.

    Using _ms As System.IO.MemoryStream = New System.IO.MemoryStream()
        _radChart.Save(_ms, System.Drawing.Imaging.ImageFormat.Png)
        page.Response.Clear()
        page.Response.ClearHeaders()
        page.Response.AddHeader("Content-disposition", "attachment; filename=" & pngName & ".png")
        page.Response.AddHeader("Content-type", "image/png")
        page.Response.BinaryWrite(_ms.ToArray())
        page.Response.End()
    End Using
    So, there is the response write.  So, how am I supposed to get the PNG image to the users?
    Phil
  2. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 18 Apr 2012 Link to this post

    Hi:
    I write a post at asp.net forum and I get 4 suggestion in the first hour, not so here.

    So, my solution has been write it to a file:
    ' Delete the file first
    Using _fs As System.IO.FileStream = New FileStream(_fileName, FileMode.CreateNew)
        _radChart.Save(_fs, System.Drawing.Imaging.ImageFormat.Png)
    End Using

    Then in javascript, I launch a window (not RadWindow), to load the file in my Download.ashx.  It is strange though, I had to call an established javascript function.
    function LaunchJavaScriptWindow(windowName, formPath) {
        var app = '<%= Request.ApplicationPath %>';
        if (app == '/') app = '';
        var aspx = app + formPath;
        window.open(aspx, windowName, 'scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,width=800,height=550', false);
    }

    Phil
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top