This is a migrated thread and some comments may be shown as answers.

Convert string to a report object

0 Answers 196 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bader
Top achievements
Rank 1
Bader asked on 28 Feb 2012, 02:41 PM

Hi, 

I need to convert a string ('QReporting.Projects.Cy.ByStartDateAndEndDate.MyReport') to a report object. I mean, I need to create an instance similar to:

//reportViewr.Visible = true;
            ReportViewr1.Report = new QReporting.Projects.Cy.ByStartDateAndEndDate.MyReport();
            Telerik.Reporting.Report report = (Telerik.Reporting.Report)ReportViewr1.Report;

So, I'm trying to convert the string to object using the following code:

ReportViewer1.Report = ((ReportViewer)Enum.Parse(typeof(ReportViewer), "QReporting.Projects.Cy.ByStartDateAndEndDate.MyReport", true)).Report;
            Telerik.Reporting.Report report = (Telerik.Reporting.Report)ReportViewer1.Report;


But I'm getting an error:
Exception Details: System.ArgumentException: Type provided must be an Enum.
Parameter name: enumType

Please, I need your help solving the above issue

 

Regards,

Bader

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Bader
Top achievements
Rank 1
Share this question
or