Forum  General Visual ...  Announce It! ( ...  ReportViewer control - Temporary workaround for VWG SDK 6.2.3
Previous Previous
 
Next Next
New Post 1/30/2009 2:57 PM
Resolved
  palli
11787 posts
1st Level Poster




ReportViewer control - Temporary workaround for VWG SDK 6.2.3 
Modified By palli  on 1/30/2009 7:08:30 PM)

Hi,

Many of you have had frustrated experience lately with current ReportViewer control in Visual WebGui version 6.2.x, especially 6.2.3. There is a referencing problem within that version that forces users to use version 8 of the Microsoft.ReportViewer.WebForm control and that in turn does not seem to provide you with the print button. Please note that an issue has been filed about this problem (here), which will in time provide you with a permanent fix.

To try to help you some in the meantime, I decided to go through the back door (as all of you could have done of course), and simply use the new ASP.NET Wrapper to create a wrapper around the Microsoft.ReportViewer.WebForm version 9 control and see if I could use that. The results were a pleasant surprize, as with minor adjustments to the code generated by the wrapper, I could use my new ReportViewer9 control to view local reports (don't have reportserver running here, so I couldn't test remote reports).

What came as even more surprize was that with just a small trick, the FireFox display issue for the current VWG 6.2.3 ReportViewer control could be solved, so now I have a working ReportViwer control for both IE and FF3. The only difference/problem is that in FF3, then print button will not show. Didn't solve that and don't know yet if that can be solved.

I will provide you with a small temporary test application below, which includes both my wrapped control, as well as a small test program. More about that later. First, I am going to tell you what you need to do to wrap such a control your self, as it is remarkably easy ! You should first read the wrapper howto article here. My projects are written for VB.NET 2008, so my description applies to VB.NET. Minor differences can exist for C#. Everything is based on the current VWG 6.2.3 NET3.5 VS2008 SDK library.

Steps to create the wrapped control:

  • Create a new project, ReportViewer9Wrapper, of type Visual WebGui Library
  • Delete the UserControl1 control. You will not need it.
  • Add references to Microsoft.ReportViewer.WebForms and make sure it's version 9
  • Add references to System.Web
  • Right click on project, select Add and then ASP.NET Control Wrapper
  • In the list of control, select ReportViewer and make sure it's from the correct namespace (Microsoft.ReportViewer.WebForms) and it's version
  • Name the control (at the bottom) ReportViewer9



Now you have a wrapped control that you must do minor fixes for by editing the ReportViewer9.designer.vb file (right click, view code)

  • The class is now declared as "Partial Class", which means it's "Friend" and can't be used outside of the project. Change to "Partial Public Class"
  • There is a declaration for "Public Sub Reset()" in the code. You will get some errors with calls to that proc. Simply rename it and have "Public Sub ResetHostedViewer()"
  • You will get error for "Public Sub Dispose()", which you fix by simply set "Public OverLoads Sub Dispose()"

That is about it! Now you have a working library project with a working ReportViewer9 control that you can use in you test application.

Two things that are worth mentioning.

  • FireFox 3 has problems displaying the current VWG ReportViewer control, as you can see in the Catalog demo app. The fix for that is the same as the fix Eyal Albert mentions in the Wrapper howto article (see above). Simply add the following code in your ReportViewer9 control class, and FF3 will behave:

    Protected Overrides ReadOnly Property IsFixedSize() As Boolean
        Get
            Return True
        End Get
    End Property

  • Second, switching report files (.rdl) at runtime, that is loading one and then loading another, requires that you call your new ResetHostedViewer() function you created above, before you load the second report. Probably best to call it before loading any report to make sure the control has been properly initialized.


Now to how to use the new wrapper in an application.

  • First you have to reference your app to your new library that contains the wrapper control.
  • Next you have to register your control in VWG, via the VWG integration tabs, register control.
  • Then you have to add the following line to the httpHandlers section of your web.config:


    <add verb="*"
        path="Reserved.ReportViewerWebControl.axd"
        type = "Microsoft.Reporting.WebForms.HttpHandler,
            Microsoft.ReportViewer.WebForms,
            Version=9.0.0.0,
            Culture=neutral,
            PublicKeyToken=b03f5f7f11d50a3a" />

 

  • Pleae note that the above should be all in one line, with no linebreaks.

The application / wrapper demo has been uploaded and you can find it here. It includes both the Wrapped control in a library, as well as two simple samples on how to use the control. One of the samples (Employees) is based on the NorthWind database, so you will get errors if you have not got that. You can view the source code anyway, and you will not get the error until you press the "Employee" button. The code is very little or not documented, except for this description here in this message. It's only purpose is to temporary help you being able to use the viewer, until the official ReportViewer will be fixed.

Hope this helps some both to see how easy it really is using the Wrapper, as well as making the ReportViewer9 control temporary available to you, until the referencing problems will be fixed in later version.

Palli




 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 1 Reports
New Post 4/25/2009 8:02 PM
  basemawad
33 posts
No Ranking


Re: ReportViewer control - Temporary workaround for VWG SDK 6.2.3 

I started to create the report wrapper, but i got to step Right click on project, select Add and then ASP.NET Control Wrapper , then I stopped because there is not asp.net control wrapper in my list. what am I missing?

Thanks!

p.s I could not use your sample app because I am using c#.

 

 
New Post 4/28/2009 3:09 AM
  ori.cohen
4390 posts
1st Level Poster




Re: ReportViewer control - Temporary workaround for VWG SDK 6.2.3 

Hello Basem,

You should not be looking for ASP.NET control wrappers but actually ASP.NET controls that you would like the VWG MS Visual Studio instegration to wrap for you.
Please view this article here for details. I am sure it will help clarify things for you.

Palli only writes code in VB.NET. If you want to see a C# translation of that code, you can use code converters like this one here.

Regards,

Ori Cohen
Support Manager, the Visual WebGui team

 
New Post 5/10/2009 1:34 PM
  rdhatch
635 posts
1st Level Poster




Re: ReportViewer control - Temporary workaround for VWG SDK 6.2.3 
Modified By rdhatch  on 5/10/2009 4:37:01 PM)

Thanks, Palli - You're my hero!

I was getting an array error using v6.3.6's ReportViewer control (which targets ReportViewer 8, VS 2005).  Your v9 Wrapper is working great with ReportViewer 9, VS 2008.

I'm making a go of ReportViewer instead of CrystalReports this time around.  Going to see how well I can get it to work.  What's wonderful is that I've now been able to export my LLBLGen objects to a Typed DataSet, and automatically generate all the Relations between all the DataTables.  Perhaps for you ReportViewer guys this is no big deal because you can databind to an Object, however Crystal Reports can only bind to a DataSet.  This is important because all my [very complex] Calculated fields now come over into the DataSet.  This extremely simplifies the Reports & eliminates much of the needs for custom formulas in the Reports.

Just wanted to stop & say Thank you!

Ryan


Ryan D. Hatch, VWG MVP
GeniusCode.net | VWG Community Frameworks | VWG Wiki
 
New Post 5/10/2009 3:01 PM
  palli
11787 posts
1st Level Poster




Re: ReportViewer control - Temporary workaround for VWG SDK 6.2.3 
Modified By palli  on 5/10/2009 6:02:04 PM)

Hi Ryan,

You are most welcome !

Worst that I have not been able to use it myself yet, but the time will come...Just glad if you can use it.

Last week I had to recall all my Crystal 8.5 knowledge and change a very complex 8.5 report.... about 20 subreports and all ... not fun... I will convert it to Microsoft Reporting report one day.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  Announce It! ( ...  ReportViewer control - Temporary workaround for VWG SDK 6.2.3
Assessment Bottom
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS