Displaying PDF throws error when Ajax on page

2 posts, 0 answers
  1. David Penny
    David Penny avatar
    174 posts
    Member since:
    Jun 2006

    Posted 02 Sep 2010 Link to this post

    Hi,

    I have a page running a generated Crystal Report which is producing a PDF file.  I then display this using the following code:

    Using client As System.Net.WebClient = New System.Net.WebClient()
        HttpContext.Current.Response.ContentType = "application/pdf"
        HttpContext.Current.Response.WriteFile(FileName)
        HttpContext.Current.Response.Flush()
        HttpContext.Current.Response.Close()
        HttpContext.Current.Response.End()
    End Using

    This works fine when the page does not use Ajax, but as soon as I add Ajax to it an error gets thrown.  I would like to Ajaxify the page so I can show a progress spinner as the report is generated, rather than leave a few seconds when it looks like nothing is happening.

    If I remove Ajax from the page thie code works fine.

    Add Ajax and it stop working.

    Is there an alternative, or better method of showing the PDF (I also show a Word or Excel document, depending on the selection the user has made)

    Dave Penny
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 02 Sep 2010 Link to this post

    Hello David,

    Possible reason for this behavior is that your export button is ajaxified. Please examine the following link:
    Export from ajaxified grid

    If this is not the case, please provide a sample code so I can examine your approach.

    Greetings,
    Pavlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top