Wijmo C1ReportViewer, Document property, error

Posted by: haus on 10 September 2017, 11:42 am EST

  • Posted 10 September 2017, 11:42 am EST

    I recently "upgraded" my project to the Wijmo C1ReportViewer control. Spent the better part of the day figuring out how to replace the now-missing Document property (see code below -- hopefully might help someone. The documentation is pretty bad for this tool).

    Things are working, but I get the following error in the generated script with the new wijmo C1ReportViewer control. Continuing / Ignoring the error seems to work.

    Microsoft JScript runtime error: 'this._outlineContainer' is null or not an object


    <wijmo:C1ReportViewer ID="rpt" runat="server" Height="700px" Width="600px" Zoom="Fit Page"
    AvailableTools="None" CollapseToolsPanel="True" ToolBarVisible="True" FileName="Rental View">
    </wijmo:C1ReportViewer>



    Imports C1.Web.Wijmo.Controls.C1ReportViewer

    Partial Class Reports

    Inherits PageBaseClass

    Dim rptSQL As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    rptSQL = " where t_order.status = 1 "

    If Profile.LoginType = "C" Then
    rptSQL += " and t_order.cust_id = " & Profile.ID
    Else
    rptSQL += " and t_order.custshipto_id = " & Profile.ID
    End If

    C1ReportViewer.RegisterDocument("Rental View", AddressOf RentalView)

    End Sub

    Private Function RentalView() As C1.C1Preview.C1PrintDocument

    Dim rep As C1.C1Report.C1Report = C1ReportViewer.CreateC1Report()

    rep.Load(Server.MapPath("~/Reports/rental_view.xml"), "Rental View")
    rep.DataSource.ConnectionString = "Provider=SQLOLEDB;" & ConString

    SQL = rep.DataSource.RecordSource
    SQL = Replace(SQL, "{where}", rptSQL)

    rep.DataSource.RecordSource = SQL
    rep.Render()

    Dim doc As C1.C1Preview.C1PrintDocument = C1ReportViewer.CreateC1PrintDocument

    doc = rep.C1Document

    RentalView = doc

    End Function

    End Class


    Please let me know if the error is a bug or if I'm doing something wrong.

    Thanks,
    Dan
  • Replied 10 September 2017, 11:42 am EST

    Hello Dan,

    I tried to bind a C1ReportViewer with RecordSource and it works fine at my end i,e, no error occurs. Could you kindly check the attached sample and if it works properly, then modify it so that it reproduces the issue.

    I tested it with the latest build which is available at the following link:
    http://prerelease.componentone.com/dotnet30/C1WebWijmo.Webforms/2011-T3/

    Moreover, I have escalated the documentation issue to the concerned team and would update you as soon as I hear anything from them.

    Regards
    Ashish
    2011/12/C1WijReportViewer_RecorrdSource.zip
  • Replied 10 September 2017, 11:42 am EST

    Hello Ashish, thanks for the reply. I was already using the most current version of the control. The sample you provided worked fine; thank you (it would have certainly saved me time yesterday!) I changed 3 lines of code to point it at my report instead of yours, the Load, ConnectionString, and RecordSource, and I was able to produce the error.

    Microsoft JScript runtime error: ‘this._outlineContainer’ is null or not an object

    I'm guessing it has something to do with my report design file, but the exact same file did not error out under the older AJAX version of the control.

    I'll openly admit to not understanding what "Wijmo" is or it's benefits... but I'm moving back to the AJAX control. It seems to work better, has the Document property which is easier to work with, and frankly, it looks better too.

    Thanks,
    Dan
  • Replied 10 September 2017, 11:42 am EST

    Hello Dan,

    I understand your situation but would request you to send me your report xml along with sample database so that I can check the same and find out the source of error.

    Regards
    Ashish
  • Replied 10 September 2017, 11:42 am EST

    Ashish, see the attached report definition file. Unfortunately I cannot provide that database as it is a 1GB+ SQL Server database.

    Also, I may have initially created this in the older VSReport version of the report designer (but again, the AJAX version of C1Reports didn't seem to care). I did open and re-save the file using the newest version of the report designer, but it didn't make a difference.

    Thanks,
    Dan
    2011/12/rental_view.zip
  • Replied 10 September 2017, 11:42 am EST

    Hello Dan,

    I checked your report xml and it looks fine to me but it would be very difficult for me to conclude anything without replicating the issue.

    I would suggest you to check the attached sample where I am changing the SQL query at the runtime as it may help you in your application.

    Regards
    Ashish
    2011/12/C1WijReportViewer_RecordSource.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels