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

How to use a custom property on a report?

1 Answer 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 12 Jul 2010, 01:53 AM
Hi..
I added property to my report called   _total_cost

 

public partial class  Total_Tons : Telerik.Reporting.Report

 

{

 

    public decimal _Total_Cost { set; get; }


I have code that calculates the the total cost in the ctor of the Report

this.DataSource = _lstInvoices

 

 

var ct = _lstInvoices.Sum(c => c.cost);

 

_Total_Cost =

Convert.ToDecimal(ct);


How can I use this value in the TEXTBOX ?

When I set the text value to.....
Value =   "= (Sum(Fields.cost)/_Total_Cost)*100"

I get an error 

"_TOTAL_COST is NOT DEFINED IN THE CURRENT CONTEXT'


thanks in advance

 

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 13 Jul 2010, 07:41 AM
Hi Jon,

You cannot use a custom property directly in a report expressions. You can however create a User Function
which works with your custom property and returns the desired result. More information is available in the latter article.

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
Jon
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or