Telerik Forums
Reporting Forum
3 answers
1.1K+ views

I have a main report having subreport whose reportsource has to be set dynamically based on the field value (Response type) of the sqldatasource of mainreport ,
I tried to get the value of Responsetype from the dataobject in detail_itemdatabinding event and stored in a variable .
I subreport_itendataBinding event tried to set Telerik.Reporting.SubReport.reportsource to new object of TypeReportSource class, then invalidcastexception is ocurring
Unable to cast object of type 'Telerik.Reporting.Processing.SubReport' to type 'Telerik.Reporting.SubReport
'Telerik.Reporting.Processing.SubReport does not have REportsource property so i used Telerik.Reporting.SubReport, but exception is happening

Kindly assist on this issue

 public partial class InterviewReport : Telerik.Reporting.Report
    {
        protected string reportSourceValue = "";
        public InterviewReport()
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        private void detail_ItemDataBinding(object sender, System.EventArgs e)
        {
            Telerik.Reporting.Processing.DetailSection item =
                (Telerik.Reporting.Processing.DetailSection)sender;
         
            object o = item.DataObject["ResponseType"];
            if (o is string)
            {
                if (string.Equals(o, "Text Response"))
                {
                    this.reportSourceValue = "ReportLibrary.Reports.Response, ReportLibrary, Version=1.0.0.0, Culture=neutral, " +
     "PublicKeyToken=null";
                }
                else if (string.Equals(o, "Check Box"))
                {
                    this.reportSourceValue = "ReportLibrary.Reports.ReportCheckBox, ReportLibrary, Version=1.0.0.0, Culture=neutral, " +
      "PublicKeyToken=null";
                }
            }
        }

        private void subReport1_ItemDataBound(object sender, System.EventArgs e)
        {
            // Telerik.Reporting.Processing.ReportItemBase item =
            // (Telerik.Reporting.Processing.ReportItemBase)sender;
            Telerik.Reporting.SubReport sub = (Telerik.Reporting.SubReport)sender;

            Telerik.Reporting.TypeReportSource typeReportSource2 = new Telerik.Reporting.TypeReportSource();
            typeReportSource2.Parameters.Add(new Telerik.Reporting.Parameter("LocalEngID", "= Parameters.LocalEngID.Value"));
            typeReportSource2.Parameters.Add(new Telerik.Reporting.Parameter("InterviewQuestionsID", "=Fields.InterviewQuestionsID"));
            typeReportSource2.TypeName = reportSourceValue;
            sub.ReportSource = typeReportSource2;
        }

    }

 

Regards,

Mary Jain

Ian
Top achievements
Rank 1
 answered on 06 Jun 2017
5 answers
646 views
I'm using Q2 2012 of Telerik reporting. I need to use the NeedDataSource event to populate my subreports. My subreports are populated by objects that inherit Reporting.Report. When I run the report, I get this error

An error has occurred while processsing Report 'Group' (my object)
An error has occurred while resolving  '' data source: Object reference not set to an instance of an object.

this is my needDataSource
protected void needDataSource(object sender, EventArgs e)
            {
                Telerik.Reporting.Processing.ReportItemBase subreport = sender as Telerik.Reporting.Processing.ReportItemBase;
                if (this.DataSource != null)
                {
                    ods = new ObjectDataSource();
                    ods.DataSource = this.DataSource;
                    ods.DataMember = groupid;
                    ods.Parameters.Add(new ObjectDataSourceParameter(groupid));
                    subreport.Report.DataSource = ods;
                }              
            }

Thanks in advance!
Gersh
Stef
Telerik team
 answered on 05 Jun 2017
3 answers
1.2K+ views

Greetings!  

I need help with receiving parameters from a report. The following code allows me to alter the DataSource of such Report, however I still need to intercept and alter the parameters used on that report.

 

01.public Telerik.Reporting.ReportSource Resolve(string report)
02.    {
03.        ReportSource reportInstance;
04.         
05.        //retrieve an instance of the report
06.        var connectionString = "Data Source=OurServer;Initial Catalog=OurDataBase;User ID=xxxxxxxx;xxxxxxx;";
07.        ReportConnectionStringManager csm = new ReportConnectionStringManager(connectionString);
08. 
09.        var appPath = HttpContext.Current.Server.MapPath("~/");
10.        var reportsPath = Path.Combine(appPath, "Reports");
11.        var uri = Path.Combine(reportsPath, report);
12. 
13.        var sourceReportSource = new UriReportSource() { Uri = uri };
14. 
15.        reportInstance = csm.UpdateReportSource(sourceReportSource);
16. 
17.        return reportInstance;
18.    }

Is it possible to receive and modify parameters from the report call utilizing HttpContext.Current ?  Or is there a Telerik Class/Method that allows me to do so?

Thanks in advance! Best Regards. 

Stef
Telerik team
 answered on 05 Jun 2017
3 answers
182 views
An have an MVC app with a report viewer control that displays a report. The report has links in it that navigate to another report. The parameters are the same for both reports with the exception of one additional parameter for the drillthrough. I am programatically passing the parameters to the parent report from my MVC app. I want the user to be able to modify the parameter selection and refresh the drillthough report without having to go back to the parent report. Is this possible? 
Stef
Telerik team
 answered on 05 Jun 2017
1 answer
85 views

I'm developing a WPF application, using Visual Studio 2017 Community and SQL Server 2.016. The version of the report generator is R2 2017 11.1.17.503

The strange thing is that the data appears when the DataSource is configured. However, when you run Preview, the detail line data is invisible.

My stored procedure uses a temporary table and creates the SQL command dynamically.

Could someone please help?

Katia
Telerik team
 answered on 05 Jun 2017
1 answer
553 views
I can't seem drag and drop the columns. Are there other alternatives to reordering existing columns at design-time?
Stef
Telerik team
 answered on 02 Jun 2017
2 answers
741 views
Hi,

In the footer part of my report page, I want to show print date and time the format of the datetime will be YYYY-MM-DD HH:mm PM, I will to regulate the format using the Format property in the property window.  I just can not figure out how to show AM or PM accordingly.  Can you give me the format mask, or could you give me a list of format mask I can use for future reference?

Thanks,

enrique
Top achievements
Rank 1
 answered on 01 Jun 2017
2 answers
228 views

Hello!  I have installed the Angular 4 component.  My Angular project is up and running, but the component is acting funny.  It isn't even TRYING to connect to the report server before throwing the classic "Error loading the report viewer's templates. " error.  I've seen all the FAQ stuff about making sure that the reporting api is running, and it definitely is.  The weird thing is that the component doesn't even try to connect.  I'm monitoring the requests in the browser, and nothing ever goes toward the reporting api at all.

 

I'd love to be able to use this component, but I'm having trouble even getting off the ground with it.

Yes, I have Angular 4 and jQuery 3.2.1.  I installed the component off NPM.

Thanks for any help you can provide!

 - Chris

Chris
Top achievements
Rank 1
 answered on 31 May 2017
1 answer
271 views
I just started my trial period and am still trying to figure things out.

I have an ASP.NET MVC website. I added a Terlerik Report Library project to my solution. In it, I created a report using Visual Studio Report Designer. The report uses an ObjectDataSource which points to a function in a custom DLL in my solution. When I run my website and go to the 
report viewer page I get the error:

The assembly "MyLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" is not permitted to be used by an ObjectDataSource component. Please include it in an AssemblyReferences element in the Telerik.Reporting configuration section of your application configuration file


I have tried copying this from the report library's app.config to my website's web.config
   <Telerik.Reporting>
        <Cache provider="" />
        <cache provider="" />
        <assemblyReferences>
            <add name="MyLib" version="1.0.0.0" />
        </assemblyReferences>
        <SessionState provider="" />
        <restReportService>
            <storage provider="" />
            <reportResolver provider="" />
        </restReportService>
    </Telerik.Reporting>
but this causes my website to have a config error: "The configuration section 'Telerik.Reporting' cannot be read because it is missing a section declaration"

I have also found this forum post
http://www.telerik.com/forums/the-assembly-xxx-is-not-permitted-to-be-used-in-an-objectdatasource

but I don't understand things well enough yet to know what I'm supposed to do with a custom resolver.
Stef
Telerik team
 answered on 31 May 2017
1 answer
164 views

Hello, 

 

I have a Polar graph with some data points, I have formatting rules for these data points so they change colors based on some data. Howevever, when the points are on the northern axis and in this middle circle they have the correct color but the axis looks like its being rendered ON TOP of the point. How do i fix this? 

 

 

Ivan Hristov
Telerik team
 answered on 31 May 2017
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?