Telerik Forums
Reporting Forum
2 answers
165 views
The Master-Detail using Subreports documentation makes sense when your data is coming from a database, but not when you are using an ObjectDataSource and you want your subreport to be bound to a collection property on that object.

I got this working but was looking for some feedback as to if I'm doing this the hard way and also as a reference as the docs seem lacking in this area.


readonly System.Xml.XmlReaderSettings _settings = new System.Xml.XmlReaderSettings { IgnoreWhitespace = true };
 
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        Telerik.Reporting.Report report;
        using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(@"Report.trdx", _settings))
        {
            var xmlSerializer = new ReportXmlSerializer();
            report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
        }
        report.DataSource = GetDataSource(); //List<ParentObject>
        var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
 
        var instanceReportSource = new InstanceReportSource { ReportDocument = report };
        report.Items["detail"].ItemDataBinding += ReportOnItemDataBinding;
 
        ...
 
    }
}
 
private void ReportOnItemDataBinding(object sender, EventArgs eventArgs)
{
    var detailSection = sender as Telerik.Reporting.Processing.DetailSection;
 
    using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(@"SubReport.trdx", _settings))
    {
        var xmlSerializer = new ReportXmlSerializer();
        var subReport = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
        subReport.DataSource = ((ParentObject)detailSection.DataObject.RawData).Children;
        var sr = (SubReport)detailSection.ItemDefinition.Items["subReport1"];
        sr.ReportSource = new InstanceReportSource {ReportDocument = subReport};
    }
}
Rip
Top achievements
Rank 1
 answered on 11 Dec 2012
1 answer
143 views
Hi all,

IS there any way for the report to persist it's report generation timestamp on the date it was first printed?

I've tried this:  http://www.telerik.com/community/forums/reporting/telerik-reporting/show-current-date-time-on-report-header.aspx but the date will change each time you open up the report again. thanks in advance 
Steve
Telerik team
 answered on 10 Dec 2012
0 answers
96 views

 

In the Sales by product line per period the demo show how the columns and the rows can be expanded and collapsed, but I don't see a way to do this? I cannot find this information in the documentation? How is this accomplished?

Eric Klein
Top achievements
Rank 1
 asked on 10 Dec 2012
2 answers
145 views
Here is the exact error that is reported when telerik and the session state are configured(it's attached as image file).  When using telerik reporting tool..I'm using sql datasouces to get values and here is the all code that I used..I used designer part to create the report  page..
namespace TelerikReporting
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;
    using System.Configuration;
    using System.Data.SqlClient;
    using DataService.ConnectionFactory;
 
    public partial class PropRep : Telerik.Reporting.Report
    {
        public PropRep(int ID)
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();
            this.ReportParameters["ID"].Value = ID;
            PropTest.Parameters["@ID"].Value = ID;
            PropTest.ConnectionString = ConnectionFactory.GetConnectionString(ConnectionType.SQLConnection);
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
    }
}

This is code for aspx page which has Report Viewer
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:ReportViewer ID="ReportViewer1" Width="100%" Height="800px" runat="server"></telerik:ReportViewer>
    </div>
    </form>
</body>
</html>

and this is the aspx.cs codebehind part of the page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
public partial class Reporting_Report : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["PID"] != null)
            {
                int ID = Convert.ToInt32(Request.QueryString["PID"].ToString());
                Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
                instanceReportSource.ReportDocument = new TelerikReporting.PropRep(ID);
                this.ReportViewer1.ReportSource = instanceReportSource;
            }
  
        }
    }
}
Peter
Telerik team
 answered on 10 Dec 2012
1 answer
79 views
Hi,

I have a report that is currently using a SQL Data Source for its data, which is working fine. However, my program uses this same SQL query in various classes. This means that the same query is being stored in the sqlDataSource component within my Telerik report, as well as in my SQL.cs file, which contains all queries used within my C#.

Is there a way of getting my Telerik report to get the SQL for its data source from the SQL.cs file, rather than having to duplicate this SQL code?

Thanks,
Ashley
Ashley
Top achievements
Rank 1
 answered on 10 Dec 2012
1 answer
108 views
Dear Telerik Team ,

     I am creating a table dynamical from code behind not in design time where  the number of columns are dynamic and  i  have a requirement where i need  to display summary at end of each column how do i achieve this without using the design wizard.
Thank you.

Regards, 
 Kiran

  
Steve
Telerik team
 answered on 10 Dec 2012
1 answer
154 views
Is it possible to change report size according to paper settings in runtime? Docking and anchoring didn't make any effect.
Steve
Telerik team
 answered on 07 Dec 2012
1 answer
135 views
Hi,
I got a requirement here.
I have 3 parameters , one of them is  a multivalue parameter.
Based on the number of values in multivalued parameter , i need to create Panel in the report



how can i access the parameters in the designer which is passed by the report viewer ?





Thanks
Peter
Telerik team
 answered on 07 Dec 2012
1 answer
117 views
Hello,

I'm using a dynamic table to display a schedule on a report. The table is laid out with a header row and a single data row for the scheduled items. As soon as the text in one of the data row's cells is larger than can be displayed the complete row won't be rendered any more. The report contains only the header row and no second page.

Is there a property on the TextBox element that enables PageBreaks inside the Box itself or am I missing something else?

Kind regards
Markus

Here's the code I use to define the table, it's called from the report's constructor:

private void BuildTable(ScheduleInfo context) {
    //create empty table
    var scheduleTable = new Table {
        Location = new PointU(Unit.Cm(0), Unit.Cm(0)),
        Name = "ScheduleTable",
        RowHeadersPrintOnEveryPage = true,
        KeepTogether = false
    };
 
    //insert table in detail section
    Details.Items.AddRange(new ReportItemBase[] { scheduleTable });
 
    var rowGroup = new TableGroup();
 
    //add header row
    scheduleTable.Body.Rows.Add(new TableBodyRow(Unit.Cm(0.8)));
 
    //set page layout
    if (context.Columns.Count<5) {
        ToPortrait();
    }
    else {
        ToLandscape();
    }
 
    var columnWidth = Width/context.Columns.Count;
    var minWidth = Unit.Mm(30);
    if (columnWidth < minWidth) columnWidth = minWidth;
 
    var rowHeight = Unit.Mm(6);
    var i = 0;
 
    foreach (var column in context.Columns) {
        scheduleTable.Body.Columns.Add(new TableBodyColumn(columnWidth));
 
        var headerText = new TextBox {
            Value = column.Header,
            Size = new SizeU(columnWidth, rowHeight)
        };
 
        headerText.Style.Font.Bold = true;
 
        var cellInfo = column.Appointments != null
            ? string.Join("\n\n", column.Appointments.Select(x => x.ToString()))
            : null;
 
        var cellText = new TextBox {
            Value = cellInfo,
            Size = new SizeU(columnWidth, rowHeight),
            KeepTogether = false
        };
 
        scheduleTable.Body.SetCellContent(0, i, cellText);
 
        var colGroup = new TableGroup {ReportItem = headerText};
        colGroup.GroupKeepTogether = false;
        scheduleTable.ColumnGroups.Add(colGroup);
 
        scheduleTable.Items.AddRange(new ReportItemBase[] { headerText, cellText });
 
        i++;
    }
 
    rowGroup.Groupings.AddRange(new [] {new Grouping("")});
    rowGroup.Name = "DetailGroup";
    rowGroup.GroupKeepTogether = false;
    scheduleTable.RowGroups.Add(rowGroup);
 
    Details.Items.Add(scheduleTable);
}

Markus Wolff
Top achievements
Rank 1
 answered on 07 Dec 2012
10 answers
260 views
Hi ,

 As Export options(combo and export link) is disabled , we cannot export the report.

On the button click,  we are showing reports in report viewer.

kindly tell me the solution for this.


Thanks for the help



Eduardo
Top achievements
Rank 1
 answered on 06 Dec 2012
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?