locked
refreshreport is not a member of 'microsoft.reporting.webforms.reportviewer' RRS feed

  • Question

  • User-10248131 posted

    Hello, I just switched from Crystal Report to Reporting Service and created my very first page with a ReportViewer to show my report (.rdlc), below is my code:

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                q = Request.QueryString.Get("ID")
    
                If q Is Nothing Then
                    MyUtilities.Show_Message(Me, "Please check the ID")
                Else
                    dt = GetFullServerInfoForReportingByID(User.Identity.Name, Convert.ToInt16(q))
    
    
                    Me.ReportViewer1.ProcessingMode = ProcessingMode.Local
    
                    ReportViewer1.LocalReport.DataSources.Clear()
                    ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("ReportDataSource", dt))
                    ReportViewer1.DocumentMapCollapsed = True
                    ReportViewer1.RefreshReport()
                    ReportViewer1.Show()
                End If
            End If
        End Sub

    My VS2008 reports error on ReportViewer1.RefreshReport() and ReportViewer1.Show()

    RefreshReport is not a member of 'microsoft.reporting.webforms.reportviewer'

    Show is not a member of 'microsoft.reporting.webforms.reportviewer'

    What's the right code I should put here to generated my report?

    Thank you very much.

    Thursday, February 6, 2014 11:48 AM

All replies

  • User1140095199 posted

    Hi,

                    ReportViewer1.RefreshReport()
                    ReportViewer1.Show()
    

    These two methods does not exit. There is no Show() method though there is a ReportRefresh() method.

    You can try the following code:

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
    Dim rds As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource
    Me.ReportViewer1.Reset()
    Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "DataAccessQuickStart.rptGetProductsByCategory.rdlc"
    Me.ReportViewer1.LocalReport.DisplayName = "Get Products By Category"
    Me.ReportViewer1.LocalReport.DataSources.Clear()
    rds.Name = "GetProductsByCategory_GetProductsByCategory"
    rds.Value = SalesData.GetProductsInCategory(2).Tables("table")
    Me.ReportViewer1.LocalReport.DataSources.Add(rds)
    Me.ReportViewer1.RefreshReport()
    
    End Sub
    

    Refer to the following link for more info:
    http://www.codeproject.com/Articles/31862/Dynamic-Binding-Of-RDLC-To-ReportViewer

    Best Regards!

     

    Friday, February 7, 2014 3:58 AM
  • User-10248131 posted

    Thank you Sam,

    I didn't indicate this is a web app as the forum is all about web app.

    Maybe I should have posted more here:

    Environment: VS2008, .NET 3.5 (I do also have VS2012 .NET4.5 installed on this same machine)

    THis is from web.config:

    				<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

    This is from the page:

    <%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
    

    The whole page contains only one reportviewer control.

    Suggested by error message, I also put the following code in web.config

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

    Your suggested  code has no significant change to mine, and also reports error on:

                    Me.ReportViewer1.RefreshReport()

    Same error:  'RefreshReport' is not a member of 'Microsoft.Reporting.WebForms.ReportViewer'. 

    In the design pane, it doesn't show the ReportViewer, there is a message saying:

    failed to create designer: Microsoft.ReportViewer.WebForms.ReportViewer, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

    I hope you can get more insight to this issue and find the root cause for me.

    Thank you very much.

    Friday, February 7, 2014 9:21 AM
  • User-10248131 posted

    While troubleshooting this issue, I keep seeing another annoying issue, some .dll files keep getting automatically added in the Solution Explorer under \bin, I have to manually deleted them.

    I double checked web.config, they are not there.

    why this happens?

    Thanks.

    P.S. The dlls that will be auto added are:

    System.Web.Mvc.dll/xml

    System.Web.Razor.dll/xml

    System.Web.WebPages.Razor.dll/xml

    System.Web.WebPages.Deployment.dll/xml

    Microsoft.Web.Infrastructure.dll/xml

    System.Web.WebPages.dll/xml

    Friday, February 7, 2014 10:14 AM
  • User-777988094 posted

    It's too bad Microsoft never bothers to address the issue with the "Failed to Create designer" error when trying to use the reportviewer control in Visual Studio. this has been an issue since at least VS2008 (and still exists in VS2013). All kinds of suggestions on things to try by users. I remember a few years ago I actually got it to work in VS2010.

    Now here I sit this evening trying to work on a number of reports in VS2013 and I have the @%@#% Failed to Create Designer error.

    It's obvious Microsoft has no intention of fixing issues if they can get away with it. Just move on to another release so they can pad sales.

    I wish there was an alternative.

    Sunday, February 16, 2014 8:57 PM
  • User1140095199 posted

    Hi,

    The Code Provide would also work for Web Form. Basics are same.

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
    ReportDataSource = New ReportDataSource
    Me.ReportViewer1.Reset()
    Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "Report1.rdlc"
    Me.ReportViewer1.LocalReport.DisplayName = "Get Products By Category"
    Me.ReportViewer1.LocalReport.DataSources.Clear()
    rds.Name = "GetProductsByCategory_GetProductsByCategory"
    rds.Value = SalesData.GetProductsInCategory(2).Tables("table")
    Me.ReportViewer1.LocalReport.DataSources.Add(rds)
    Me.ReportViewer1.RefreshReport()
    
    End Sub

    Refer and Modify!

    mdivk

    System.Web.Mvc.dll/xml

    System.Web.Razor.dll/xml

    System.Web.WebPages.Razor.dll/xml


    These are basically DLL for MVC apps. Are you using MVC??

    MVC and WebForms both are uses ASP.NET but they work entirely differently.

    If you are using MVC you cannot use the Report like we do it in WebForm.

    You might have added some references related to MVC or might be using RAZOR syntax. I certainly feel there are referencing issues in you web app. Try to check out if you are using MVC.

    Similar Issues related to binding has been addressed many times and resolved . Here are few links that might be useful:

    How to bind the dataset to the reportviewer dynamically...  - http://social.msdn.microsoft.com/Forums/en-US/f2216f66-1f20-49f1-a18a-a871f87d8d53/how-to-bind-the-dataset-to-the-reportviewer-dynamically?forum=vsreportcontrols

    How to dynamically assign ReportViewer to .rdlc - http://social.msdn.microsoft.com/Forums/en-US/c6524b68-bdfd-4f10-848f-355bc9445323/how-to-dynamically-assign-reportviewer-to-rdlc?forum=vsreportcontrols

    Best Regards!

    Best Regards!

    Wednesday, February 26, 2014 9:28 PM