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

Q3 2013 + MVC: reportSource = instance of report

1 Answer 103 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
MiBu
Top achievements
Rank 1
MiBu asked on 16 Oct 2013, 09:36 PM
My situation in Q2 and old reportViewer:

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="System.Data" %>
 
<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=7.1.13.802, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Reporting, Version=7.1.13.802, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.Reporting" TagPrefix="telerik" %>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title></title>
    <style type="text/css">  
    html#html, body#body, form#form1, div#content
    {
        height: 100%;
    }
    </style>
</head>
<body>
    <script runat="server">
        public override void VerifyRenderingInServerForm(Control control)
        {
            // to avoid the server form (<form runat="server"> requirement
        }
         
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            //IMPORTANT PART: setting source to instance of report passed from controller
            ReportViewer1.ReportSource = Model.Report;
        }
 
    </script>
    <form id="main" method="post" action="">
        <telerik:ReportViewer ID="ReportViewer1" Width="100%" Height="600px" runat="server">
        </telerik:ReportViewer>
    </form>
</body>
</html>

Here I can create an instance of report on server and pass it to this view to render it on client.

While I'm waiting for documentation to come out, please help me how to do this in new html5 report viewer, and what is the best/recomended practice to render reports now?

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 Oct 2013, 01:18 PM
Hi Mirko,

The HTML5 report viewer report source sets the initial report and parameter values. On the server side this string will be converted to a ReportSource through an IReportResolver. That said this string may contain everything as far as the Telerik Reporting REST Service knows how to convert to a reports source that will be passed to the report engine for further processing. For example this may be an assembly qualified type name that can be converted to TypeReportSource, a path to a report definition file (.trdx) as in the UriReportSource, or even a report id that a dedicated IReportSourceResolver will use to read the report definition stored in a database in xml format and converted to a XmlReportSource. For more information check out the REST Service Report Resolver help article.

Based on the provided information our recommendation is to use the TypeReportSource. For example check out the demos that came with your Telerik Reporting installation.

Additionally you may find useful the How-to: Using HTML5 Report Viewer extension in an ASP.NET MVC4 application help article.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
General Discussions
Asked by
MiBu
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or