Monday, July 08, 2013

Telerik Report doesnt see custom objects /class using objectDataSource

       public class EventTypeCompanysEvents
        {
            public EventType eventType ;
            public School school ;
            public Event _event ;
        }       
public static List<EventTypeCompanysEvents> GetEventsByType(List<int> eventTypeIDs, List<int> schoolIDs, DateTime startDate, DateTime endDate)
I was getting  "not defined in current context" error ,trying to call
 a method("GetEventsByType" in this case) inside an objectdataSource.
The method is fully working and tested ,yet Telerik Report was not seeing the fields of the
objectDataSource.
Here is the solution:
Convert  members of your custom class to properties:
 public class EventTypeCompanysEvents
        {
            public EventType eventType { getset; }
            public School school { getset; }
            public Event _event { getset; }
        }
 and now you can drag your fields to your report ! 

No comments:

Post a Comment