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

Access Report items which are in header from a table in detail section

1 Answer 301 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pavan
Top achievements
Rank 1
Pavan asked on 05 Apr 2012, 10:42 AM
I have a report with header and multiple sub sections in details section.
For each subsection we have placed table and assigned corresponding datasource.
In header i have a textbox which contains patient related data.
Eg:textbox1 -->Expression--> [=Fields.NameField]


Now i need to display a caluculate field in table1 column based on the value of the textbox in header section.

eg:
Table1
----------------
textbox2-->Expression-> =FormatName() (UserDefined function)

In code behind file .cs

public static string FormatName()
{
return textbox1.Value+ "Busineess Logic";
}
But i am not able to access textbox1 here in this method as the method is declared as static.

How to achieve this in telerik ???

1 Answer, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 09 Apr 2012, 11:57 AM
Hello Pavan,

When using Custom Functions you can also pass expressions to them. For e.g.  =FormatName(Fields.NameField) will pass the already evaluated expression to the user function. If it is something simple like string concatenation you don't even need functions - you can do it in the expression for e.g. = Fields.Name + " " + Fields.Age will concatenate the two strings with space between them. 
You should also keep in mind that if you assign DataSource to the Report, the Fields cannot be used directly in the Report Header/Footer - they need to be used with Aggregates. If you explain in more detail what exactly is your scenario and what do you need to achieve, we might be able to give you more concrete solution. 

Greetings,
Elian
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
Tags
General Discussions
Asked by
Pavan
Top achievements
Rank 1
Answers by
Elian
Telerik team
Share this question
or