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

Accessing Fields Programmatically

2 Answers 540 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
turntablistlp
Top achievements
Rank 1
turntablistlp asked on 19 Apr 2009, 06:50 PM
I'm trying to access data programmatically (after it's already bound) and I'm not sure where to start (I'm very new to Telerik Reporting).  I know from within the report designer I can use Fields.[FieldName] to access a specific column from the current row being displayed; what I'm looking for is something equivalent I can access programatically.

The reason I would like this capability is because I have to dynamically create different Textboxes in my detail section, since different records require a different layout.  I was unable to find what I'm looking for in the documentation or by searching (perhaps I just don't know the correct terminology), so any help is appreciated.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 22 Apr 2009, 12:27 PM
Hello turntablistlp,

You can go to the InitializeComponent() method to see how a =Fields.MyField is represented in code i.e.:

this.nameDataTextBox.Value = "=Fields.Name";

The only difference is that when you're in the context of a report/item event, you need to work with the processing report items and not with their definitions. More info on the matter is available in the Understanding Events help article.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
turntablistlp
Top achievements
Rank 1
answered on 24 Apr 2009, 06:04 PM
Steve,

Thanks for the info and the link.  After studying the help article again (I had read it before but obviously didn't look close enough), I see part of the answer in the sample code - how to access the data row directly for the currect record, within the detail_ItemDataBound event handler.  I didn't even think of using =Fields.Name as a string for the TextBox's value, I was thinking somehow "Fields" was an object I should be accessing in code... now it seems so easy.

Everything works as it should now in my code, thanks!

Jason
Tags
General Discussions
Asked by
turntablistlp
Top achievements
Rank 1
Answers by
Steve
Telerik team
turntablistlp
Top achievements
Rank 1
Share this question
or