Showing posts with label telerik report. Show all posts
Showing posts with label telerik report. Show all posts

Thursday, September 05, 2013

Optional filtering of parameters in a Telerik Report


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 { get; set; }
            public School school { get; set; }
            public Event _event { get; set; }
        }
 and now you can drag your fields to your report ! 

Wednesday, June 26, 2013

Fix to "Object must implement IConvertible" error when using objectdatasource withy multivalue parameter under Telerik Reports

If you want to pass multivalue parameters to an objectdatasource you have to make sure the argument type of the objectdatasource's method is object array. You cannot pass a List or array integer or etc.
In the method body convert the object [] to the needed array type  . You can do it this way:
parameter is:
(object[] eventTypes)
   
            int[] eventTypeIDs = eventTypes.Select( Convert.ToInt32).ToArray();

Tuesday, June 25, 2013

Telerik Report doesnt see referenced classes/methods

I have static classes which has the DAL methods which I want to use in my Telerik Report
To do that I drag an objectDataSource to my report and none of those classes I referenced show up in Configure Object Data Source wizard.
Here is a quick solution:
Just add a public struct like  this to each one of your static class , recompile DAL and Telerik now will see your methods
        public struct  ShowMyClass{};