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

Table textbox.value blank

3 Answers 259 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pierre-Alain
Top achievements
Rank 1
Pierre-Alain asked on 01 Oct 2010, 05:41 PM
Hello,

I'm trying to create a dynamic table columns. It's almost working, but the actual data is not showing up:

public partial class ProductsReport : Telerik.Reporting.Report
    {
        public ProductsReport()
        {
            InitializeComponent();
 
            detail.ItemDataBound += detail_ItemDataBinding;
        }
 
        private void detail_ItemDataBinding(object sender, EventArgs e)
        {
            var section = sender as Telerik.Reporting.Processing.DetailSection;
            var processingTable = section.ChildElements.Find("periodsTable", true)[0] as Telerik.Reporting.Processing.Table;
            var dataObject = section.DataObject;
            var productPricingInfos = dataObject.RawData as ProductPricingInfos;
            processingTable.DataSource = productPricingInfos.ProductPricePeriods;
 
            //create two HtmlTextBox items (one for header and one for data) which would be added to the items collection of the table
            Telerik.Reporting.HtmlTextBox textboxHeader;
            Telerik.Reporting.HtmlTextBox textBoxData;
 
            //we do not clear the Rows collection, since we have a details row group and need to create columns only
            this.periodsTable.ColumnGroups.Clear();
            this.periodsTable.Body.Columns.Clear();
            this.periodsTable.Body.Rows.Clear();
            int i = 0;
            this.periodsTable.ColumnHeadersPrintOnEveryPage = true;
 
            //common fields
            var tableGroupColumnCommon = new Telerik.Reporting.TableGroup();
            periodsTable.ColumnGroups.Add(tableGroupColumnCommon);
            periodsTable.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Unit.Inch(1)));
 
            textboxHeader = new Telerik.Reporting.HtmlTextBox();
            textboxHeader.Style.BorderColor.Default = Color.Black;
            textboxHeader.Style.BorderStyle.Default = BorderType.Solid;
            textboxHeader.Value = "Du";
            textboxHeader.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
            tableGroupColumnCommon.ReportItem = textboxHeader;
 
            textBoxData = new Telerik.Reporting.HtmlTextBox();
            textBoxData.Style.BorderColor.Default = Color.Black;
            textBoxData.Style.BorderStyle.Default = BorderType.Solid;
            textBoxData.Value = "=Fields.StartDate";
            textBoxData.Size = new SizeU(Unit.Inch(1.1), Unit.Inch(0.3));
            this.periodsTable.Body.SetCellContent(0, i++, textBoxData);
            this.periodsTable.Items.AddRange(new ReportItemBase[] { textBoxData, textboxHeader });
             
 
        }
    }

You can see at the bottom textBoxData.Value = "Fields.StartDate". I took this from an example submitted by you guys.

I'm probably missing a bind or something...I really don't know.

3 Answers, 1 is accepted

Sort by
0
Pierre-Alain
Top achievements
Rank 1
answered on 01 Oct 2010, 10:20 PM
Well...I've got it working. I've just binded the periodsTable Datasource to =Fields.ProductPricePeriods and ive got it working.

Now, the only thing thats bugging me is why in preview mode, html preview mode or online in a ReportViewer, the first element of the subreport is always blank but when I export to PDF, its there! See the attached screenshot and PDF.
0
Pierre-Alain
Top achievements
Rank 1
answered on 02 Oct 2010, 03:07 AM
The files....couldnt upload them while editing
0
Steve
Telerik team
answered on 05 Oct 2010, 04:29 PM
Hi Kogik,

Most likely you have set the DataSource to the definition table item, when it should be set to the processing object instead when in the context of event. More information on definition vs. processing is available in our documentation: Understanding Report Items.

Kind regards,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Pierre-Alain
Top achievements
Rank 1
Answers by
Pierre-Alain
Top achievements
Rank 1
Steve
Telerik team
Share this question
or