Telerik Forums
Reporting Forum
1 answer
217 views
I am using the HTML 5 control in a MVC application.  I have my test report being displayed but the format is wrong (see attache file).  It prints correctly when outputting it to PDF.

The code to display the report is -

@model EPH.Models.ReportViewerModel
 
@{
    ViewBag.Title = "Reports";
}
 
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link href="~/ReportViewer/styles/telerikReportViewer-8.1.14.804.css" rel="stylesheet" />
 
<script src="~/ReportViewer/js/telerikReportViewer-8.1.14.804.js"></script>
 
<style>
    #reportViewer1 {
            position: relative;
            width: 100%;
            height: 500px;
        }
</style>
 
@{
    var reportSource = new UriReportSource() { Uri = "TestReport.trdx" };
}
 
<div class="container">
    <form class="form-horizontal" id="myform" name="myform" method="post" role="form">
        <div class="form-group">
            <div class="col-md-4">
                <div class="panel panel-default equal">
                    <div class="panel-heading">Report List</div>
                    <div class="panel-body">
                        <label class="col-md-2 control-label input-sm">Report Name:</label>
                        <div class="col-md-8">
                            @Html.DropDownListFor(m => m.ReportId, new SelectList(Model.ReportsTextList, "ReportId", "Name"),
                                         new { @class = "form-control input-sm-select", @id = "report-selection" })
                        </div>
                    </div>
                </div>
                <div id="panel_ReportParameters" class="panel panel-default equal">
                    <div class="panel-heading">Report Parameters</div>
                    <div class="panel-body">
                        @Html.Partial("_ReportParameters")
                    </div>
                </div>
            </div>
            <div class="col-md-8">
                <div class="panel panel-default equal">
                    <div class="panel-heading">Selected Report</div>
                    <div class="panel-body">
                        @(Html.TelerikReporting().ReportViewer()
                                .Id("reportViewer1")
                                .ServiceUrl(Url.Content("~/api/reports/"))
                                .TemplateUrl(Url.Content("~/ReportViewer/templates/telerikReportViewerTemplate-8.1.14.804.html"))
                                .ReportSource(reportSource)
                                .ViewMode(ViewModes.INTERACTIVE)
                                .ScaleMode(ScaleModes.SPECIFIC)
                                .Scale(1.0)
                                .PersistSession(false)
                                .PrintMode(PrintMode.AutoSelect)
                        )
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 nopadright">
                <div class="col-md-4">
                </div>
                <div class="col-md-4">
                    <a href="" id="viewbutton" type="button" class="btn btn-info" style="width:100%">Update Report</a>
                </div>
            </div>
        </div>
    </form>
</div>
 
<script>
    $('#report-selection').change(function () {
        var reportId = $(this).val();
        //        alert(reportId)
        $.ajax({
            type: "POST",
            url: '@Url.Action("RefreshReport")',
            traditional: true,
            data: { reportId: reportId },
            success: function (data) {
            }
        });
    });
 
</script>
Squall
Top achievements
Rank 1
 answered on 19 Sep 2014
5 answers
587 views
Hi,

I am using Telerik for WPF, Reporting, Designer and WPF Viewer. This issue is related with Report Designer.

I have test report with a chart. Datasource is connected to my ObjectDataSource with this member signature:

List<KeyValuePair<DateTime, Decimal>> GetData(int32 year, Object[] months)

I created report parameter of type string with Multiple=True and available values as array of strings: ["Jan","Feb","Mar"....]

Everything works flawlessly except Design mode. I do not know what to pass in "Configure Design Time Parameters" dialog for months argument - when configuring ObjectDataSource.

I tried:
Jan; Feb
"Jan", "Feb"

This ones gives 
System.InvalidCastException: Invalid cast from 'System.String' to 'System.Object[]'.

=Array("Jan","Feb")
["Jan","Feb"]

This ones gives
System.Reflection.TargetInvocationException: Property accessor 'DefaultValues' on object 'Telerik.Reporting.Data.Design.ObjectDataSourceDesigner' threw the following exception:'Index was outside the bounds of the array.' ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.

And in this case I cannot even open "Configure" dialog for data source, because it throws the same exception as above and shows message box with text "Index was outside the bounds of the array."

I searched documentation and I cannot find any information how to set design time parameters for object[] ObjectDataSource arguments. Can anyone point me in right direction?



Stef
Telerik team
 answered on 18 Sep 2014
3 answers
110 views
When a row group is added to a report is adds a column on the left by default spanning several rows. Adding a DocumentMapText entry on this rowgroup generates a document map which is shown on the left when the report is rendered. 

In our application we need to group rows together but since we have limited horizontal space (we have a large number of columns) we normally add the row group with a header, then either delete or hide the row group column on the left. 

However, as soon as that column is deleted or set to invisible the document map entries for that row group disappears. The row group still renders (we get all the row group info we need in the row group header and/or footer), but the document map is empty.

Stef
Telerik team
 answered on 17 Sep 2014
2 answers
278 views
Hi,

I have multvalue parameter with available values connected to ObjectDataSource:

IEnumerable<int> GetMonths()

Now I am trying to display first value from that list in TextBox:

{=First(Parameters.Months.Value)}

This renders as empty.

But this works:

{ = Join(",",Parameters.Months.Value)}

How can I use agregate fuctions on multivalue parameters?

Thanks,
Łukasz
Lukasz
Top achievements
Rank 1
 answered on 17 Sep 2014
3 answers
90 views
Im serialize report in xml string.
How can I load xml string in ReportViewer(Silverlight)
without WCF and Rest Services
alexhome
Top achievements
Rank 1
 answered on 17 Sep 2014
8 answers
624 views
I have a MVC application where I have a bunch of reports.  I want the user to be able to select a report they want to view, select the parameters and then display the selected report when they click a button.  How do I go about doing this?
Stef
Telerik team
 answered on 16 Sep 2014
3 answers
909 views
I am downloading Telerik as we speak to evaluate. I have spent a couple of weeks battling with SSRS.

Can you please point me to a simple report using VB.net, WinForms and SQL Server?

Also, if you know, if I buy a license for creating reports can I use it on my desktop and laptop, or do I need to buy two licenses?

Thanks,
John
Stef
Telerik team
 answered on 15 Sep 2014
3 answers
523 views
Hi,

I am new to Telerik Reporting and is currently like what I am seeing.
However,  I have this scenario where I have subreports. I would like to hide these sub reports when there is no data on it.
Currently, if there's no data it will show the reportHeadersection of that subreport to my master.

Thanks
Stef
Telerik team
 answered on 15 Sep 2014
1 answer
133 views
Hello.  I have a fairly simple problem with an ASP.NET application, and I'm hoping there is a simple solution.

I've created a class in my Visual Studio 10 solution called RFO_Output.cs.  I chose to not create a separate class library for two reasons (1) the reports I'm creating are not going to be shared in other applications (2) I couldn't find an example of how to call those external reports from an ASP.Net application.  Including it in my solution was easy enough, so I went that route.

The report is a simple banded report, but in my case I only want to show a single record at a time. The RFO_Output.cs class has a Telerik SQLdatasource component with the following SQL code in it (a very simple select):

SELECT [DCN_Outage_Ticket]
      ,[Event_Start_Time]
      ,[Event_End_Time]
      ,[Duration_Days]
      ,[Duration_Hours]
      ,[Duration_Minutes]
      ,[Duration_Seconds]
      ,[Summary]
      ,[Root_Cause]
      ,[Preventative_Measures]
  FROM tblMOPReason_For_Outage

I've created an ASP Panel on one of the .aspx pages in my solution, and included a Telerik ReportViewer component in the panel, with a button provided so that the end-user can have the panel be hidden or visible. The ReportViewer component has its ReportSource property set to the RFO_Output class mentioned above.  So far, no problems.  The Telerik examples are clear and helpful to this point.

My question involves how to limit my report to the desired records.  In my case, I want to select a particular row from the table above, based on a column in the same table.  I can add a WHERE clause, of course, then either pass a parameter ("WHERE KeyCol = @KeyVal") or modify the SQL at runtime to include the value ("WHERE KeyCol = 5").  But this is where things get murky.

The "Using Parameters with the SqlDataSource" component help page shows how to add a new SqlDataSource object in the C# code itself, but doesn't give an example of how to update an existing SqlDatasource already in the report class, or how to assign this new SqlDataSource to an existing reportsource.

I tried the following code:
            Telerik.Reporting.SqlDataSource thisSource = new Telerik.Reporting.SqlDataSource();
            thisSource.ConnectionString = "DCNConnectionString";
            thisSource.SelectCommand = "SELECT [DCN_Outage_Ticket], [Event_Start_Time] ,[Event_End_Time] ,[Duration_Days] " +
                                     "      ,[Duration_Hours] ,[Duration_Minutes] ,[Duration_Seconds] ,[Summary] " +
                                     "      ,[Root_Cause] ,[Preventative_Measures] FROM tblMOPReason_For_Outage " +
                                     "WHERE RFO_UID = " + HidRFOID.Value.ToString();
            Telerik.Reporting.Report thisReport = ReportViewer1.ReportSource as Telerik.Reporting.Report;
            thisReport.DataSource = thisSource;

But this doesn't compile, as the conversion from ReportSource to Report fails.  (An interesting side note is that the Telerik add-in doesn't show this as an error, but it shows up at compile time.)

Any suggestions on how to make this happen would be appreciated.  I'm not clear on how to update the SQL code for an in-place SQLDataSource, or how to reference the in-place report so that I can point it at a new SQLDataSource.

Thanks for your input on this.
Stef
Telerik team
 answered on 15 Sep 2014
1 answer
94 views
Since we have a number of common things in our reports we like to create a base class (derived from report). We put all the common stuff in the base class, including a few custom properties.

The Telerik report designer does not like this, after changing the base class from "Report" to "BaseReport" the designer does not render the report correctly any more, it only shows the report items (tables etc), not the report itself.

This behaviour is contrary to how VS normally handles this. This method of having a customised base class works for other VS components such as forms and datasets. 
Stef
Telerik team
 answered on 15 Sep 2014
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?