<navigation:Page |
x:Class="GestionMembre.About" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" |
xmlns:RepportViewer="clr-namespace:Telerik.ReportViewer.Silverlight;assembly=Telerik.ReportViewer.Silverlight" |
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" |
Style="{StaticResource PageStyle}" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"> |
<Grid x:Name="LayoutRoot"> |
<RepportViewer:ReportViewer x:Name="xReportViewer" ReportServiceUri="../ReportService.svc" Report="ReportLibrary.BasicReport, ReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"> |
</RepportViewer:ReportViewer> |
</Grid> |
</navigation:Page> |
private IEnumerable<ChartSeries> CategoryEvolutionSeries(Telerik.Reporting.Chart chart) |
{ |
var cats = issues.GroupBy(x => x.CategoryName); |
List<string> Categorias = new List<string>(); |
foreach (var cat in cats) |
{ |
Categorias.Add(cat.Key); |
} |
foreach (string cat in Categorias) |
{ |
var IssuesPerCat = issues.Where(x => x.CategoryName == cat); |
var group = IssuesPerCat.GroupBy(x => x.DateCreated.ToString("yyyy/MM")); |
ChartSeries series = new ChartSeries(); |
series.Appearance.PointMark.Dimensions.Width = 5; |
series.Appearance.PointMark.Dimensions.Height = 5; |
series.Appearance.PointMark.FillStyle.MainColor = Color.Black; |
series.Appearance.PointMark.Visible = true; |
group = group.OrderBy(x => x.Key); |
series.Appearance.LabelAppearance.Visible = false; |
series.Appearance.ShowLabels = true; |
series.Name = cat; |
series.Type = ChartSeriesType.Line; |
foreach (var issue in group) |
{ |
ChartSeriesItem item = new ChartSeriesItem(); |
item.YValue = issue.Count(); |
series.Items.Add(item); |
} |
yield return series; |
} |
} |
defChart.Series.Clear(); |
foreach (ChartSeries item in evolseries) |
{ |
defChart.Series.Add(item); |
} |
chart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Reporting.Charting.Styles.ChartValueFormat.ShortDate; |
List<Issue> issues = new List<Issue>(); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-01-2010")}); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-01-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-01-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-02-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-02-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-03-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-04-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-04-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-04-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-04-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-04-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-05-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-05-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-05-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-06-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-06-2010") }); |
issues.Add(new Issue() { CategoryName = "Teste1", DueDate = DateTime.Parse("01-06-2010") }); |
var cats = issues.GroupBy(x => x.CategoryName); |
List<string> Categorias = new List<string>(); |
chart1.Series.Clear(); |
chart1.PlotArea.XAxis.MinValue = DateTime.Parse("01-01-2010").ToOADate(); |
chart1.PlotArea.XAxis.MaxValue = DateTime.Parse("01-07-2010").ToOADate(); |
foreach (var cat in cats) |
{ |
Categorias.Add(cat.Key); |
} |
foreach (string categoria in Categorias) |
{ |
var issuesissuesPerCat = issues.Where(x => x.CategoryName == categoria); |
var groupedIssues = issuesPerCat.GroupBy(x => x.DueDate.ToString("dd/MM/yyyy")); |
ChartSeries series = new ChartSeries(); |
series.Type = ChartSeriesType.Line; |
foreach (var issue in groupedIssues) |
{ |
ChartSeriesItem csitem = new ChartSeriesItem(); |
csitem.YValue = issue.Count(); |
series.Items.Add(csitem); |
chart1.PlotArea.XAxis.AddItem(issue.Key); |
} |
chart1.Series.Add(series); |
} |
I have several reports that are built dynamically that stopped working after we upgraded to the Q3 2009 release, using version 3.2.9.1211. I tried setting the ReportViewer's EnableViewState property to false and that had no impact on the problem. When the report is generated a 1-page blank report appears.
I took one of the Telerik sample provided on this forum and put it in a small, much simpler project. I receive the exact sample behavior. Here is the code that I am using:
using
System;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data;
using
System.Configuration;
using
System.Web.Security;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Telerik.Web.UI;
using
Telerik.Reporting;
using
Telerik.Reporting.Drawing;
public
partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Telerik.Reporting.
Report rpt = new Telerik.Reporting.Report();
DataSet ds = new DataSet();
ds.Tables.Add();
DataTable table = ds.Tables[0];
int columnCount = 3;
int rowCount = 1000;
//Add columns
for (int column = 0; column <= columnCount - 1; column++)
{
table.Columns.Add(
"Column" + (column + 1).ToString(), typeof(string));
}
//Add rows
for (int row = 0; row <= (rowCount - 1); row++)
{
string[] rowVals = (string[])Array.CreateInstance(typeof(string), columnCount);
DataRowCollection rowCollection = table.Rows;
for (int column = 0; column <= columnCount - 1; column++)
{
rowVals[column] =
"value_" + (column + 1).ToString() + "_" + (row + 1).ToString();
}
table.Rows.Add(rowVals);
}
rptViewer.Report = GenerateReportDefinition(
ref ds);
rptViewer.RefreshReport();
}
private Telerik.Reporting.TextBox CreateTxtHeader(string FieldName, int i)
{
Telerik.Reporting.
TextBox txtHead = new Telerik.Reporting.TextBox();
txtHead.Value = FieldName;
return txtHead;
}
private Telerik.Reporting.TextBox CreateTxtDetail(string FieldName, int i)
{
Telerik.Reporting.
TextBox txtHead = new Telerik.Reporting.TextBox();
txtHead.Value =
"=[" + FieldName + "]";
return txtHead;
}
Telerik.Reporting.
Report GenerateReportDefinition(ref System.Data.DataSet dataSource)
{
Telerik.Reporting.
Report report1 = new Telerik.Reporting.Report();
report1.DataSource = dataSource;
int count = dataSource.Tables[0].Columns.Count - 1;
Telerik.Reporting.Drawing.
Unit x = Telerik.Reporting.Drawing.Unit.Inch(0);
Telerik.Reporting.Drawing.
Unit y = Telerik.Reporting.Drawing.Unit.Inch(0);
SizeU size = new SizeU(Telerik.Reporting.Drawing.Unit.Cm(2), Telerik.Reporting.Drawing.Unit.Inch(0.3));
Telerik.Reporting.
ReportItemBase[] headColumnList = new Telerik.Reporting.ReportItem[count];
Telerik.Reporting.
ReportItemBase[] detailColumnList = new Telerik.Reporting.ReportItem[count];
for (int column = 0; column < count; column++)
{
string columnName = dataSource.Tables[0].Columns[column].ColumnName;
Telerik.Reporting.
TextBox header = this.CreateTxtHeader(columnName, column);
header.Location =
new Telerik.Reporting.Drawing.PointU(x, y);
header.Size = size;
headColumnList[column] = header;
Telerik.Reporting.
TextBox textBox = this.CreateTxtDetail(columnName, column);
textBox.Location =
new Telerik.Reporting.Drawing.PointU(x, y);
textBox.Size = size;
detailColumnList[column] = textBox;
x += Telerik.Reporting.Drawing.
Unit.Inch(1);
}
Telerik.Reporting.
ReportHeaderSection reportHeaderSection1 = new Telerik.Reporting.ReportHeaderSection();
reportHeaderSection1.Height =
new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType.Inch);
//reportHeaderSection1.Style.BackgroundColor = Color.LightGray;
reportHeaderSection1.Items.AddRange(headColumnList);
Telerik.Reporting.
DetailSection detailSection1 = new Telerik.Reporting.DetailSection();
detailSection1.Height =
new Telerik.Reporting.Drawing.Unit(0.3, Telerik.Reporting.Drawing.UnitType.Inch);
detailSection1.Items.AddRange(detailColumnList);
report1.Items.Add(reportHeaderSection1);
report1.Items.Add(detailSection1);
return report1;
}
}