DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Can't open a report in a new window, without using url

  1. #1
    Join Date
    Sep 2006

    Question Can't open a report in a new window, without using url

    Sounds simple but here is what I need. I have an aspx webform that asks the user for 19 parameters that my report requires. I need to validate the form and have a button that the user can click and have the report open in a new window. Like I said the report has 19 parameters and we would like to avoid passing the parameters in the url. Here is what I’ve tried:

    Using cross-page postback I can pass the parameters captured in the Getparameters webform to the viewreport webpage but it opens on the same window. I can use a regular button or a linkbutton and added “onclick” attributes to run clientside validation before submitting a form. The viewreport webpage has a reportviewer control. I just need to open the report in a new window.

    Tried javascript in several places (btnView “onclick”, linkbutton “onclick”, registerclientscriptblock (runs after the form is posted) all giving me the error “object null reference exception” on the report parameters.

    Lastly I’m trying to use SOAP and running render method for button on_click but I keep getting the error report path not valid report path needs to be less than 260 characters and must start with slash. Here is the code that I’m using for render method:

    Dim rs As New RSWebReference.ReportingService
    rs.Credentials = System.Net.CredentialCache.DefaultCredentials

    'Render Arguments
    Dim result As Byte = Nothing
    Dim reportPath As String = "/Sales/MonthlySales"
    Dim format As String = "PDF"
    Dim historyID As String = Nothing
    Dim devInfo As String = “<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

    'Prepare report Parameters
    Dim parameters(0) As RSWebReference.ParameterValue

    parameters(0) = New RSWebReference.ParameterValue
    parameters(0).Name = "Date"
    parameters(0).Value = "09/10/2006"

    Dim credentials() As RSWebReference.DataSourceCredentials = Nothing
    Dim showhidetoggle As String = Nothing
    Dim encoding As String = ""
    Dim mimeType As String = ""
    Dim warnings() As RSWebReference.Warning = Nothing
    Dim reportHistoryParameters As RSWebReference.ParameterValue() = Nothing
    Dim streamID As String() = Nothing

    rs.Render("MonthlySales", "PDF", historyID, devInfo, parameters, credentials, showhidetoggle, encoding, mimeType, reportHistoryParameters, warnings, streamID)

    I just want to know if what I want to accomplish is even posible because I’ve been at this for over a week, going Crazy!

    I thought maybe the report needed credentials set instead of nothing, but don’t know how to do that.

    Any help is immensely appreciated!

  2. #2
    Join Date
    Jun 2004
    Make the FORM's tag ACTION value to your view page, and add an attribute TARGET=_BLANK (in small letters). Then use the Request.Form to get the variables.
    To resize your view page use JavaScript to change the width and height. You will not be able to hide menus, address bar etc.

    Another way to do so would be create every thing on the same page (where the user passses the parameter, make a DataSet and save it in cache. Then write JavaScript on the postback (here you should be able to control the menus) to open the viewreport page. Since your DAtaSet is cached, you can bind the data and then just remove it from cache.
    Here are a few scripts that might help:
    new to programming but getting ther

  3. #3
    Join Date
    Sep 2006
    Thank you very much! I can't believe I missed something as simple as the target attribute. The reason for my other error was that I actually added the wrong reference. But got that fixed and now everything works fine!

Similar Threads

  1. Replies: 1
    Last Post: 10-15-2002, 11:35 AM
  2. Open new window with no toolbar and menubar
    By WooGor in forum ASP.NET
    Replies: 6
    Last Post: 12-05-2001, 09:08 AM
  3. How to open a new window?
    By Bjarte K. Helland in forum Java
    Replies: 0
    Last Post: 11-02-2001, 08:02 PM
  4. Replies: 0
    Last Post: 06-03-2001, 09:17 AM
  5. Open new window
    By john rigsby in forum Web
    Replies: 1
    Last Post: 05-28-2000, 01:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center