Reportviewer Local Mode

Discussion in 'ASP .Net Web Controls' started by Madison, Oct 5, 2007.

  1. Madison

    Madison Guest

    Hi there,

    I'm working with web site project using vs 2005. I wonder should I use
    reportviewer local mode to write all my reports. What is advanced /
    disadvanced of it? I have 3-4 books about asp.net but nothing mention about
    the reportviewer control. If any of you can point me to some web site that
    have samples it would be appreciated.
    Thanks.

    ps - my reports are depending on criterial which users selected.
     
    Madison, Oct 5, 2007
    #1
    1. Advertisements

  2. Hi Madison,

    For vs 2005 reportviewer control, it support both clientreport and server
    report. Here are some of the difference and comments I can summarize:

    **server report means the report the completely hosted on the SQL server
    reporting service, you can develop the report through those SQL Server
    2005's BI studio report projects and then deploy them onto reportserver.
    The advantage is that you can adopt those powerful settings and
    services(such as security ..) of the report services. Of course, you'll
    need a SQL server license here:)

    ** For Client report, you no longer need a SQL Server(license) since all
    the stuff are done within VS 2005. You author the report in VS 2005 and
    configure reportviewer directly use the client report file(RDLC file). And
    the datasource is also programmatic datasource (different from the
    datasource for server report). Surely, the design surface will be somewhat
    limited compared to SQL server reporting service server report. However,
    you no longer need a SQL server now.

    Here are some web resources on the VS 2005 reportviewer control:


    #The New ReportViewer Control in Visual Studio 2005 Provides Rich
    Capabilities to Fulfill All Your Reporting Needs
    http://steveorr.net/articles/ReportViewer.aspx

    #Using the ASP.NET 2.0 ReportViewer in Local Mode
    http://www.codeproject.com/aspnet/ReportViewer.asp?select=2248811&df=100&for
    umid=341063&exp=0

    #Building Report-enabled Applications with the New ReportViewer Controls
    (Part 2 of 2)
    http://www.devx.com/dotnet/article/30610/1954

    And you can also convert the SQL Server reporting service report(rdl file)
    to client report RDLC file:

    #Converting RDL and RDLC Files
    http://msdn2.microsoft.com/en-us/library/ms252109(vs.80).aspx

    Hope this helps some. If you have any further questions on this, please
    feel free to let me know.


    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.


    --------------------
     
    Steven Cheng[MSFT], Oct 8, 2007
    #2
    1. Advertisements

  3. Madison

    Madison Guest

    Hi Steven,

    Thank you for your reply. I just browse some of your recommend links, it's
    very helpful. I will stay with reportviewer for client only even we have SQL
    Server for our database.
    Do I need to do something different for deploy in web production server?

    Thanks.
     
    Madison, Oct 8, 2007
    #3
  4. Thanks for your reply Madison,

    I'm glad to be of assistance. For the following question:
    Do I need to do something different for deploy in web production server?
    <<<<<<

    do you mean anything worth care when deploy ASP.NET site with reportviewer
    client reports? If so, I think there hasn't much different from an normal
    ASP.NET application. For reportviewer and the client report, just make sure
    the following things:

    ** rdlc file is correctly deployed to the target place so that it is
    accessible
    ** any of the datasource (used by your report) also accessible after you
    deployed the application
    ** If you've used custom assemblies, the deployment of the custom
    assemblies is also worth care

    Anyway, welcome to post here if you have any further questions.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead
    --------------------
     
    Steven Cheng[MSFT], Oct 9, 2007
    #4
  5. Madison

    Madison Guest

    Hi Steven,
    I'm working thru creating reportviewer local mode now. It comes to my
    attention that the reports have similarity function to Access database
    report. How do I tell the page that I want to print only the report not the
    other fields on the page? I still have some troublems with report layout
    could you recommend web site about the tricks and tips reportviewer?
    Thanks.
     
    Madison, Oct 9, 2007
    #5
  6. Madison

    Madison Guest

    Hi Steven,
    I'm reading about webform reportviewer local mode and just find out that I
    cannot print report like winform. Is is true that I cannot print report or
    preview for asp.net application? What is the point to use reportviewer if you
    cannot print the report? Do you have any recommendation about how to handle
    it? I'm used vb for coding.
    Thanks.
     
    Madison, Oct 9, 2007
    #6
  7. Hi Madison,

    Thanks for your reply.

    For the printing question you mentioned, it does be an limitation of the
    client mode report. So far the webform reportviewer control only support
    printing for server report( a report from SQL Server server-side reporting
    service). However, for client report, you can use code to programmtically
    render out them(as TIFF image stream) and flush into a separate page(a
    printing dedicated page) so as to let the user print. Here are some web
    articles mentioned on this:

    #VS2005 Web ReportViewer client browser printing
    http://forums.asp.net/p/1059619/1522215.aspx#1522215

    #Re: print option in ReportViewer control in local processing mode
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=520503&SiteID=1

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.


    --------------------
     
    Steven Cheng[MSFT], Oct 11, 2007
    #7
  8. Madison

    Madison Guest

    Hi Steven,

    Thank you for your reply.

    I try to follow the coding
    http://forums.asp.net/p/1059619/1522215.aspx#1522215
    I don't know or understand how the coding working. Is it working for web
    application or window application?

    I can tell my users to handle with export to PDF/Excel first, then print the
    PDF/Excel file locally and I may go with it. I have tried it on my machine
    but not on the web server I'm not sure it will work with web server.

    The PDF looking good but how I dynamic set margin and change the font? I
    have extra white page for each report, how do I fix it? I thought it may be
    from the report layout but the table width only 6in wide.

    I'm very appreciate your help. Sincerely.
     
    Madison, Oct 11, 2007
    #8
  9. Thanks for your reply Madison,

    Well, let me explain the mechanism a little further:

    Webform ReportViewer class use a "LocalReport" class to represent a local
    report's instance in runtime memory, it has the following render method
    which can help you manually perform render task(by supplying mime, layout,
    or other formatting info) and finally get the rendered binary content of
    the report in a "Stream" object or byte[] array, see the following MSDN
    reference:

    #LocalReport.Render Method
    http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.localr
    eport.render(VS.80).aspx

    you can find that the method contains several paramters:

    =======the one you'll need to set format=======
    **format
    The format in which to render the report. This argument maps to a rendering
    extension. Only the EXCEL format is supported in this release.

    **deviceInfo
    An XML string that contains the device-specific content that is required by
    the rendering extension specified in the format parameter. For more
    information about device information settings for specific output formats,
    see "Device Informatio
    ===============

    I would choose another two articles here which dedicated on webform
    reportviewr's custom rendering&printing:


    https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1781049&SiteID=1

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=240094&SiteID=1

    In one of the example, it render the report as "PDF" or "IMF" image
    format(hold in a stream object or byte[] array) and print it through
    server-side printer. For your scenario, if your client user want to print
    the report, you need to render the binary content out in browser and let
    the user print that page which display the content(pdf or IMF image). The
    "walkthrough" one in the above articles demonstrate this.

    If you still have any questions on this, welcome to post here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.






    --------------------
     
    Steven Cheng[MSFT], Oct 15, 2007
    #9
  10. Hi Madison,

    How are you doing?

    Does the further explanation help some? If there is anything else you
    wonder, please feel free to post here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.


    -------------
     
    Steven Cheng[MSFT], Oct 17, 2007
    #10
  11. Madison

    Madison Guest

    Hi Steven,

    Thank you for your follow up.
    I just try to compile and move the code to staging server. When I try to run
    it give the error message say:
    An error occurred during local report processing.
    The definition of the report 'Main Report' is invalid.
    The report definition is not valid. Details: Data at the root level is
    invalid. Line 1, position 1.

    It did not give me any problems when I ran from my machine. Do I have to
    change any web.config or install ReportViewer.exe?

    Thanks.

     
    Madison, Oct 17, 2007
    #11
  12. Thanks for your reply Madison,

    Since it works on development machine, should be a problem due to
    deployment environment. If it only have .net framework 2.0 installed(but
    not visual studio 2005), you need to run the Reportviewer.exe
    redistributable package. ReportViewer component(assemblies) are not by
    default included in .net framework. see the following msdn reference:

    #Deploying Reports and ReportViewer Controls
    http://msdn2.microsoft.com/en-us/library/ms251723(VS.80).aspx

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.




    --------------------
     
    Steven Cheng[MSFT], Oct 18, 2007
    #12
  13. Hi Madison,

    Have you resolved the problem? If there is still anything we can help,
    please don't hesitate to post here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------
     
    Steven Cheng[MSFT], Oct 22, 2007
    #13
  14. Madison

    Madison Guest

    Hi Steven,

    Thanks for follow up.
    I haven't try to put report to web production server yet. I have to talk
    with our network person to install ReportViewer.exe on web server.
    I'm very appreciate with your help. The next step, I wil try to put report
    to word document. Can I do that with word document?
    Thanks.
     
    Madison, Oct 25, 2007
    #14
  15. Madison

    Madison Guest

    Hi Steven,

    I just finished install Reportviewer.exe in staging machine and compiled my
    web appliction. When I try to run the application with reportviewer I got the
    message say

    Server Error in '/Mywebserver' Application.
    --------------------------------------------------------------------------------

    The report definition is not valid. Details: Data at the root level is
    invalid. Line 1, position 1.
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information about
    the error and where it originated in the code.

    Exception Details:
    Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: The
    report definition is not valid. Details: Data at the root level is invalid.
    Line 1, position 1.

    The application ran fine in my development machine before I compiled.

    Thanks for your help.

    PS. As I mention about reportviewer print to word document. I figure out
    that they do not work for word or do they? Will microsoft have this add in
    for next release?
     
    Madison, Oct 26, 2007
    #15
  16. Thanks for your reply Madison,

    How are you doing?

    As you mentioned the error still occur after you've install the
    reportviewer.exe control, correct? I suggest you first open the GAC(check
    the "c:\windows\assembly" folder) and verify that the reportviewr related
    assemblies are in it.

    I've also searched some former issue and one existing problem is due to the
    VS 2005 web publishing function. So are you using the "Publish WebSite"
    function in VS 2005 to publish the application to IIS server? If so, it may
    has alter the RDLC file of the client report. You can open the two files(on
    dev box and the one in published app folder) to see whether they're
    identical or you can manually copy the rdlc from dev box again to product
    server to see whether it helps.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.


    --------------------
     
    Steven Cheng[MSFT], Oct 31, 2007
    #16
  17. Hi Madison,

    Any update on this issue?

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------
     
    Steven Cheng[MSFT], Nov 5, 2007
    #17
  18. Madison

    Madison Guest

    Hi Steven,

    Thank you for your follow up.
    I found some article about reportviewer that you can references
    ReportViewer.Common.dll
    ReportViewer.WebForms.dll
    ReportViewer.ProcessingObjectModel
    and put dll in the bin folder then you will be fine. I may try this solution.
    I did used "Publish WebSite" function in vs 2005 and un-check for all 3
    options. I must go with this otherwise I will have some problems with our 3
    party use by this application. Now I can not make any changes for content in
    aspx page any more because the compiled aspx just marker file generated. I'm
    struggling to go back using web application project (old way as framework 1)
    then I don't have to worry copy RDLC files and I can change any contents in
    web page. I spent about of time working in this project which is deadtime in
    this December. I thought I knew enough asp.net but I don't now.

    Thanks.


     
    Madison, Nov 6, 2007
    #18
  19. Thanks for your reply Madison,

    Glad to hear from you and your progress. For the web application
    publishing, are you using the "non-updatable" option? If so, the compiler
    will compile both aspx template and codebehind code into assembly(that may
    cause you not be able to modify the aspx file after publishing).

    Anyway, please feel free to post here as long as you need help.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.




    --------------------
     
    Steven Cheng[MSFT], Nov 7, 2007
    #19
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.