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">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
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
>
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?
<
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
>
C1 C2 C3 C4
AAA Blue
5 10
6 20
AAA Yellow
2 10
BBB Green
3 20
C1 C2 C3 C4
AAA Blue 5 10
6 20
AAA Yellow 2 10
BBB Green 3 20
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();
}
}
.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
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.
<%@ 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
>