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

Finding a control

1 Answer 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 18 Jul 2012, 10:55 AM
In my report I dynamically add textboxes using :
// txt.Name = myString;
detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { txt });
After adding the textbox I need to find it again by it's name held in myString but cant seem to figure it out.
Any Ideas?

The problem I have is that I have a datasource which contains an unknown number of fields apart from 1 which I will refer to as "FieldA".
I Set datasource to null, get my datatable and loop through each column. I then generate a textbox at run time and give it a value and add it to the report. I do this for all fields apart from "FieldA". FieldA has its own textbox so all I have to do is :
this.txtFieldA.Value = "Whatever";

I have noticed that when I run my report only FieldA is properly updated with the correct value. All the other textboxes contain the same information from the first row of the datatable.
I can only assume this is happening because the textbox for FieldA was added at design time and the rest at run time.
My thought is that maybe I should add each text box THEN add a value to them instead of giving each textbox a value then adding it.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 20 Jul 2012, 12:01 PM
Hi Paul,

Telerik Reporting as a reporting solution depends on declarative report definition that is processed based on the provided data. 

Still you may generate the report definition programmatically but avoid changing the report definition in runtime (events). We have attached a sample report with table definition that is generating dynamically.

You may find useful the following help articles:


If you still experience any difficulties please open a support thread and send us the problematic report definition to debug on our end.

Regards,
Peter
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or