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

Bind to Object Array - Call Objects Function

1 Answer 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
mSchmidt
Top achievements
Rank 1
mSchmidt asked on 12 Aug 2008, 03:10 PM
Hi

I earlier wrote a post on how to do what was almost a cross join and how to print this using Telerik Reporting, this was currently not very easy.

I figured that the best way simply was to load the data into a Object List and the bind the report to the list.
This all works very well however what iam wondering now is whether it is possible to call a function of the object from the report.

        public string getDayShift(int mDay)  
        {  
            foreach(shift mShift in myShifts) {  
                if ((int)mShift.Start.DayOfWeek==mDay) {  
 
                    return mShift.ToString();  
                }  
            }  
            return "";  
        }  
        public string getShift1  
        {  
            get { return getDayShift(1); }  
            set {  }  
        }  
        public string getShift2  
        {  
            get { return getDayShift(2); }  
            set { }  
        }  
 

Currently iam using the two last functions to allow me access to the function from Telerik reporting, however this gives me quite some redundant code.

Is there any way to call this function directly or is this the only way ?

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 12 Aug 2008, 03:48 PM
Hi mSchmidt,

When a report is bound to a list of business objects, only the public properties of the object class can be used as fields in the report. So you will need to have a property for each of the week days. Hopefully, when the cross-tab report item is available you will not need this anymore.

All the best,
Ross
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
mSchmidt
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or