Telerik Forums
Reporting Forum
1 answer
528 views
Overview: I am using Reporting Q1 2012 and Visual Studio 2010. I have built a very simple aspx page which contains the Q1 2012 Report Viewer control. In the code behind, I am binding the ReportViewer.Report to a deserialized instance of a .trdx file that was created using the Q1 2012 Report Designer. I have SQL Server Express 2008 R2 as the data source for the SQLDataSource defined in the report.

Problem: When I view the report (.trdx) in the Report Preview of the Report Designer, the expected data populates correctly.  When I run the web application and attempts to view the report using the ReportViewer control a blank page is displayed after the "Generating Report.." message disappears.  Print Preview mode of the ReportViewer yields the same results.  Printing and exporting to any format generates a single blank page. 

Details:
  • I have followed the official documentation for deserializing the report file and binding it to the viewer. 
  • The report has no parameters and is a simple "Select * From [Table]" select command.
  • The [Table] has only three columns.
  • The SQLDataSource connection string is NOT being stored in a configuration setting.
  • I have stepped through the code line by line to verify that the deserialized Report object connection strings are pointing at the correct server and database with appropriate access.

Code:
viewer.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="viewer.aspx.cs" Inherits="Panda.Web.App.Reports.Repository.Viewer" %>
 
<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.0.12.215, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
    Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <link type="text/css" rel="stylesheet" href="~/Styles/reset.css" />
 
    <style type="text/css">
        html#html, body#body, form#form1, div#content
        {
            height: 100%;
        }  
    </style>
</head>
 
<body id="body">
 
    <form id="form1" runat="server">
    <div id="content">
 
        <telerik:reportviewer Id="ReportViewer1" runat="server" Width="100%"
            Height="790px" ShowDocumentMapButton="False" ShowHistoryButtons="False"
            ShowPrintPreviewButton="False" Skin="WebBlue" ViewMode="PrintPreview"
            ZoomPercent="50"></telerik:reportviewer>
 
    </div>
    </form>
 
</body>
</html>

viewer.aspx.cs
var reportDefinitionFile = Server.MapPath("~/app/reports/repository/rpt/" + _reportPath);
using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(reportDefinitionFile))
{
    System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Telerik.Reporting.Report));
 
    Telerik.Reporting.Report reportDocument = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
     
    var conn = WebConfigurationManager.ConnectionStrings["Panda.Data.ConnectionString"];
    if (conn == null)
    {
        conn = WebConfigurationManager.ConnectionStrings["Panda.Data." + Environment.MachineName + ".ConnectionString"];
    }
 
    var connString = conn.ConnectionString;
 
    // Set Report datasource connections for report, parameters and all other objects
    var sds = (Telerik.Reporting.SqlDataSource)reportDocument.DataSource;
    sds.ConnectionString = connString;
 
    // parameters
    foreach (var obj in reportDocument.ReportParameters)
    {
        if (obj.AvailableValues.DataSource != null)
        {
            var ds = (Telerik.Reporting.SqlDataSource)obj.AvailableValues.DataSource;
            ds.ConnectionString = connString;
        }
    }
 
    ////// other report objects
    //SetConnectionStrings(reportDocument.Items, connString);
        
    ReportViewer1.Report = reportDocument;
    ReportViewer1.DataBind();
    ReportViewer1.RefreshReport();
}

Settings.trdx
<?xml version="1.0" encoding="utf-8"?>
<Report Width="10.45833333in" DocumentName="Panda Settings|List of global properties" Name="Settings">
  <DataSources>
    <SqlDataSource ConnectionString="Server=***\***;Database=***;uid=***;pwd=****;" SelectCommand="Select * from PandaSetting" Name="Panda" />
  </DataSources>
  <PageSettings PaperKind="Letter" Landscape="True">
    <Margins Left="0.25in" Right="0.25in" Top="0.25in" Bottom="0.25in" />
  </PageSettings>
  <DataSourceRef>Panda</DataSourceRef>
  <StyleSheet>
    <StyleRule>
      <Style BackgroundColor="" Color="28, 58, 112">
        <Font Name="Tahoma" Size="18pt" Style="Regular" />
      </Style>
      <Selectors>
        <StyleSelector>
          <Type>ReportItemBase</Type>
          <StyleName>Title</StyleName>
        </StyleSelector>
      </Selectors>
    </StyleRule>
    <StyleRule>
      <Style BackgroundColor="28, 58, 112" Color="White" VerticalAlign="Middle">
        <Font Name="Tahoma" Size="11pt" Style="Bold" />
      </Style>
      <Selectors>
        <StyleSelector>
          <Type>ReportItemBase</Type>
          <StyleName>Caption</StyleName>
        </StyleSelector>
      </Selectors>
    </StyleRule>
    <StyleRule>
      <Style Color="Black" VerticalAlign="Middle">
        <Font Name="Tahoma" Size="10pt" Style="Regular" />
      </Style>
      <Selectors>
        <StyleSelector>
          <Type>ReportItemBase</Type>
          <StyleName>Data</StyleName>
        </StyleSelector>
      </Selectors>
    </StyleRule>
    <StyleRule>
      <Style Color="Black" VerticalAlign="Middle">
        <Font Name="Tahoma" Size="8pt" Style="Regular" />
      </Style>
      <Selectors>
        <StyleSelector>
          <Type>ReportItemBase</Type>
          <StyleName>PageInfo</StyleName>
        </StyleSelector>
      </Selectors>
    </StyleRule>
  </StyleSheet>
  <Groups>
    <Group Name="labelsGroup">
      <GroupHeader>
        <GroupHeaderSection PrintOnEveryPage="True" Height="0.28125in" Name="labelsGroupHeader">
          <Items>
            <TextBox Value="name" CanGrow="True" Left="0.02083333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="nameCaptionTextBox" StyleName="Caption" />
            <TextBox Value="description" Angle="0" CanGrow="True" Left="5.23958333in" Top="0.02083333in" Width="4.46041679in" Height="0.20000001in" Name="descriptionCaptionTextBox" StyleName="Caption" />
          </Items>
        </GroupHeaderSection>
      </GroupHeader>
      <GroupFooter>
        <GroupFooterSection Height="0.28125in" Name="labelsGroupFooter">
          <Style Visible="False" />
        </GroupFooterSection>
      </GroupFooter>
    </Group>
  </Groups>
  <Items>
    <PageHeaderSection Height="0.28125in" Name="pageHeader">
      <Style>
        <BorderStyle Default="Solid" />
      </Style>
    </PageHeaderSection>
    <PageFooterSection Height="0.28125in" Name="pageFooter">
      <Items>
        <TextBox Value="=NOW()" Left="0.02083333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="currentTimeTextBox" StyleName="PageInfo" />
        <TextBox Value="=PageNumber" Left="5.23958333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="pageInfoTextBox" StyleName="PageInfo">
          <Style TextAlign="Right" />
        </TextBox>
      </Items>
    </PageFooterSection>
    <ReportHeaderSection Height="0.80823493in" Name="reportHeader">
      <Items>
        <TextBox Value="Panda Settings" Left="0in" Top="0in" Width="10.45833333in" Height="0.7874016in" Name="titleTextBox" StyleName="Title" />
      </Items>
    </ReportHeaderSection>
    <ReportFooterSection Height="0.28125in" Name="reportFooter" />
    <DetailSection Height="0.28125in" Name="detail">
      <Items>
        <TextBox Value="=Fields.name" CanGrow="True" Left="0.02083333in" Top="0.02083333in" Width="5.19791667in" Height="0.20000001in" Name="nameDataTextBox" StyleName="Data" />
        <TextBox Value="=Fields.description" Angle="0" CanGrow="True" Left="5.23958333in" Top="0.02083333in" Width="4.46041679in" Height="0.20000001in" Name="descriptionDataTextBox" StyleName="Data" />
      </Items>
    </DetailSection>
  </Items>
</Report>

Where am I going wrong?



Stef
Telerik team
 answered on 07 Feb 2013
1 answer
94 views
I have a website that includes a report with multiple subreports.  I have to add the functionality that the user can choose which subreports they can/cannot see.  For example, the user may choose to only include reports 1,3 & 5, but not 2 & 4, or any of the rest.  I will probably use some sort of list control to allow the user to select the subreports that they want included.

I have a reportviewer defined in my HTML:

<telerik:ReportViewer ID="ReportViewer1" runat="server" Height="500px" Width="100%">
                    <typereportsource typename="ETRrpts.IndividualSummary, ETRrpts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"></typereportsource>
                </telerik:ReportViewer>

So what is the optimal way for me to identify, show and/or hide the subreports based on the user's selection?

Thank you!
Hadib Ahmabi
Top achievements
Rank 1
 answered on 07 Feb 2013
3 answers
215 views
Hi,

How to show Page Footer before Report Footer on Last Page??

I have a report in which I show Pagewise Totals and Grand Total both.
But on last page Grand total comes before Page total and I want Grand total in the end of Report and Page total come before it.
I have attached screen shots...

Can i achieve this? and How?

Thanks in Advance...
Massimiliano Bassili
Top achievements
Rank 1
 answered on 06 Feb 2013
1 answer
49 views
I successfully did a report but now I want to make the cell edges ticker on each grouping to make a differentiation:

I'm using the: "=" to be thicker

Example:
=====================
=               =  detail1       =
= Group1  =__________=
=               = detail2        =
=               =_________ =
=               = detail3        =
====================
=               =  detail4       =
= Group2  =__________=
=               = detail5        =
=               =_________ =
=               = detail6        =
====================
Steve
Telerik team
 answered on 06 Feb 2013
1 answer
381 views
I have built a simple report with one group, where the data output looks something like this:
C1  C2     C3   C4
AAA Blue       
        5   10
        6   20
AAA Yellow     
        2   10
             
BBB Green      
        3   20

I need to change the format (preferably into a table) where the first line of the detail is on the same line as the group.  I need to do this because most of the time, there will only be one detail line per group. So it should look more like this:
C1  C2     C3   C4
AAA Blue    5  10
         6  20
             
AAA Yellow  2  10
             
BBB  Green  3  20
 
My existing group and detail insist on being on different lines. I suspect the way to do it has to do with adjacent left or right groups in a table, but I can't figure out how to make it work.
Stef
Telerik team
 answered on 06 Feb 2013
6 answers
205 views

Hi,

Couple of issues.

I installed reporting using and upgraded the project using the wizard.

When I try to open a report in design mode I get the problem shown in capture2.jpg which is trying to find a prior versioned dll.

Also one of reports has parameters that the viewer prompts for at runtime. the report will take the parameter but the following code that has always run in the past no longer runs:

private void RptADASummary_ItemDataBinding(object sender, EventArgs e)
 {
     if (txtStartDate.Value == string.Empty)
     {
         SchoolMonth _schoolMonth = SchoolMonthService.GetByID(Int32.Parse(this.ReportParameters["SchoolMonthID"].Value.ToString()));
         txtMonthNumber.Value = _schoolMonth.SchoolMonthNumber.ToString();
         txtStartDate.Value = _schoolMonth.StartDate.ToShortDateString();
         txtEndDate.Value = _schoolMonth.EndDate.ToShortDateString();
     }
 }

specifically it says the "this.ReportParameters["SchoolMonthID"].Value" is null.  This code has always compliled and run fine until the most recent upgrade.  has anything changed how one can access parameters in the report? If I take out the contents of this function, the report runs fine but is missing the text boxes.  see capture1.jpg

Thanks,

Jonathan
Khalid
Top achievements
Rank 1
 answered on 05 Feb 2013
0 answers
126 views

Is there a way to initially toggle visibility conditionally? I have a report that a grouping toggles the detail visibility, Everything works fine I can either have the report completely expanded, everything visible, or I can have the report open with all the Details section invisible. What I would like would be for the report to open with only one specified grouping already expanded while the other are still invisible, and then have the toggle function normally after that. Is this possible, I have played with the conditional formatting but whatever I have the detail section visibility section set to over rides the conditional, and once the conditional is set the toggle will no longer properly work.

Eric Klein
Top achievements
Rank 1
 asked on 05 Feb 2013
7 answers
288 views
I have a Telerik report that I'm exporting to Excel. My TextBox has a padding-left set, and in the designer it looks good (the text in the TextBox is indented). But when I export the report to Excel, the indenting goes away. How can I get the Excel report to indent the text in the cell?
Steven
Top achievements
Rank 1
 answered on 05 Feb 2013
1 answer
110 views
Hi,

I have MVC4 application with a partial view that contains ReportViewer control. When I viewed a page on IPad2 (iOS 6.1) the report content did not render. Report viewer showed toolbar with correct page numbers and all buttons, but the styling was lost. When I tried to export the report to PDF (worked just fine) or tried to print (worked too), and then when I used back button to return back to the report page, I was getting this error:

NullReferenceException
Object reference not set to an instance of an object. at Telerik.ReportViewer.WebForms.ViewerState.get_CurrentPage() at Telerik.ReportViewer.WebForms.ReportPageOperation.RenderReport(String format, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext) at Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride() at Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 
https://***/Telerik.ReportViewer.axd?instanceID=86efca68bccf4a05b646716ff2110e00&optype=Report&PageIndex=0&RenderID=8ce444b8b34a41ecbd219ae649ac1674&RenderingFormat=HTML

Here is the content of the aspx page:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Telerik.Reporting.ReportSource>" %>
 
<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.2.13.110, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Reporting, Version=6.2.13.110, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" Namespace="Telerik.Reporting" TagPrefix="telerik" %>
  
<!DOCTYPE html>
<html>
    <head>
        <%--<link rel="stylesheet"
            type="text/css"
            href="/Telerik.ReportViewer.axd?optype=Resource&version=6.2.13.110&name=Skins.Metro.ReportViewer.css">--%>
    </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);
                EReportViewer.ReportSource = Model;
            }
  
        </script>
        <form id="main" method="post" action="">
            <div id="repcontent">
                <telerik:ReportViewer ID="EReportViewer" Width="100%" Height="750"
                    runat="server"
                    Font-Names="Segoe UI" Font-Size="Small"
                    ShowHistoryButtons="false"
                    ZoomMode="FullPage"
                    DocumentMapVisible="false"
                    ParametersAreaVisible="false"
                    ShowParametersButton="false"
                    ShowRefreshButton="false"
                    ProgressText="Generating report"
                    ViewMode="PrintPreview" 
                    EnableViewState="false"
                    >
                </telerik:ReportViewer>
            </div>
        </form>
    </body>
</html>

The same page worked fine on my PC using any browser. The report content is displayed and control's formatting was kept.

Thanks for your help.

Steve
Telerik team
 answered on 05 Feb 2013
6 answers
98 views
Hi,
 
I am using the silverlight report viewer from Telerik Reporting Q2 2012 with Visual Studio 2010 and the problem apears when trying to export.  After the report is rendered in the report viewer, when selecting any option from the export drop down box, its content icon is replaced by the export type name and the export process does't start.
Could you please advise regarding this behavior or suggest a solution?
Thank you.

Regards,
Cristian 
Kriztine
Top achievements
Rank 1
 answered on 04 Feb 2013
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?