Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Javscript Asp.net, and SSRS

    Greetings.....

    I am not quite sure where to place this question since it involves C#, javascript and even a call to SSRS.

    What I want to do is call a Sql Server Reporting Services Report, using javascript like so:

    Code:
     ClientScript.RegisterStartupScript(GetType(), "FrameUpdate", "<script language=\"JavaScript\">" + "\n" +
                            "cursor_wait();" + "\n" +                      
                            "window.location.href ='http://serverName/ReportServer?/myReport/my Information Report&rc:Parameters=false&ANumber=" + ViewState["ANumber"].ToString().Trim() + "&BNumber=" + ViewState["BNumber"].ToString() + "&Sort_Param=" + ViewState["sortField"].ToString() + "&Sort_Direction=" +  ViewState["sortDirection"].ToString() +"&rc:Toolbar=false&rs:Command=render&rs:Format=PDF&rs:Zoom=Fit Page'; " + "\n" +                       
                            "cursor_clear();" + "\n" +
                            "<" + "/script>");
    The code works and I can pull the correct report. The issue is I wanted some visual que for the user that the report was being gernerated. that is why i used the javascript functions : cursor_wait(), and cursor_clear().

    The problem is I want to display a wait cursor untill the window with the report returns and displays the report then reset to the default cursor at that time. But the above code resets the cursor right away without waiting for the report to return. I tried adding attributes to the page form and other methods to access onBlur and such but haven't been able to get there yet.

    A very tricky problem.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    As I read this, the SSRS is going to *completely replace* the current page. No??

    So why not just put the message right into the middle of the current page and let HTML load the new stuff over the top of it??

    You could do that by maybe having this right after your <body> tag:
    Code:
    <body>
    <div id="WAIT" style="display: none; position: absolute; border: solid red 5px; padding: 100px;">PLEASE WAIT...</div>
    And then have your code do:
    Code:
    ClientScript.RegisterStartupScript(GetType(), "FrameUpdate", "<script language=\"JavaScript\">" + "\n" +
                            "document.getElementById('WAIT').style.display='block';\n" +                      
                            "window.location.href ='http://serverName/ReportServer?/myReport/my Information Report&rc:Parameters=false&ANumber=" + ViewState["ANumber"].ToString().Trim() + "&BNumber=" + ViewState["BNumber"].ToString() + "&Sort_Param=" + ViewState["sortField"].ToString() + "&Sort_Direction=" +  ViewState["sortDirection"].ToString() +"&rc:Toolbar=false&rs:Command=render&rs:Format=PDF&rs:Zoom=Fit Page';\n" +                       
                            "<" + "/script>");
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    May 2005
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    not quite......

    the SQL Server Report will open up in its own window because it will be a pdf so the pdf viewer opens outside the parent

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Wow, that's strange.

    Because the code does
    Code:
          window.location.href ='http://serverName/ReportServer"
    (with parameters after the ? that follows that) which means it *should* come into the current window. I can see that it could *then* pop open a PDF file, but I would think location.href replacement would come first.

    I wonder how ReportServer manages that???

    My head hurts.

    Do you have control over the name of the window where it pops open??
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New Coder
    Join Date
    May 2005
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Ssrs pdf

    I'm not sure how SSRS manages to open another window, but I suspect that when you add the formatting clause at the end of the querystring and choose the pdf format eg: "rc:Toolbar=false&rs:Command=render&rs:Format=PDF&rs:Zoom=Fit Page"

    The browser on the client will automatically call the adobe pdf viewer and open the viewer outside the parent. I noted leaving off the formating clause at the end of the string will cause the display of report within the Standard viewer on the parent. This is an ok solution but really I would like to let the pdf viewer display the report an figure out how to reset the cursor on the parent as my orignal question stated.

    I'm attempting to use an Ajax update panel but since I'm using a client side javascript I am still have the problem of reseting the parent.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Well, if you knew the *name* of the window that pops up, you could presumaby monitor for its presence and then change overlay accordingly.

    You can probe for a window's existence by name. But I dunno of any other way to probe.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •