Error creating C1ReportViewer

Originally Posted 30 July 2016, 4:35 pm EST

  • Originally Posted 30 July 2016, 4:35 pm EST

    I just got Studio Enterprise edition. When I open default.aspx in design view in my first look at a sample (c1reportViewerprintWithoutPreview) I see Error Creating Control -C1ReportViewer1 Unknown Server tag 'cc1:C1reportViewer' and the project won't run.

    What does that mean and how do I fix it?

    Steve Lord

  • Reply

    I have decided to ignore the error and just move on with trying to program the c1reportviewer in a web form. The issue I'm running in to now is that I cant use the following statement:

    Imports C1.C1Preview
    Imports C1.C1Report.C1Report

    Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim doc As C1PrintDocument = Me.C1ReportViewer1.CreateC1PrintDocument
    Dim rep As C1.C1Report.C1Report = Me.C1ReportViewer1.CreateC1Report()

    End Sub

    End Class


    The CreateC1PrintDocument and CreateC1Report methods are not available.I have reference to C1.C1Report.4, but I must be missing something else. What do I need to do to have access to those methods?

    Steve Lord
  • Reply

    Hello,

    Regarding your first issue:
    1. There must be some C1 dll's version conflict. You are suggested to remove all the C1 dlls references from your project. Now follow the below steps:
    a. Add a new WebForm
    b. Drag and Drop a C1ReportViewer control into the designer window
    c. This will create a licenses.licx file with correct entries (if it is not exists) or make the correct license entry into it.
    d. Now, you can remove this newly added WebForm and run your project.

    Regarding your second issue:
    2. Thank you for providing the sample code snippet. From the provided code snippet, I could observed that you have called CreateC1PrintDocument() and CreateC1Report() methods on C1ReportViewer's object, which is not recommended.
    Since, both of these methods are the static member of C1ReportViewer class therefore, you are suggested to call these methods directly by accessing the C1ReportViewer class.
    Here is the suggested code:

    Protected Function MakeDoc() As C1PrintDocument
    Dim doc As C1PrintDocument = C1ReportViewer.CreateC1PrintDocument()
    Dim report As C1Report = C1ReportViewer.CreateC1Report()
    report.Load(rptpath, rptname)
    report.DataSource.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbpath + ";Persist Security Info=False"
    report.DataSource.RecordSource = query
    report.Render()
    Return report.C1Document

    End Function


    I have also attached a sample demonstration for you. Please have a look.

    Regards,
    Prashant
    2016/08/ASP_C1ReportViewer.zip
  • Marked as Answer

    Reply

    Thank you, Prashant! I'll review the sample, but the code clarifies things for me quite a bit.
Need extra support?

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

Learn More

Forum Channels