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

GetAppointmentsInRange() returns nothing unless explicitly call DataBind()

6 Answers 85 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Michael Malone
Top achievements
Rank 1
Michael Malone asked on 24 Sep 2010, 02:54 PM
When I try to call GetApointmentsInRange() I get no results back even though my datasource contains appointments. When I call DataBind() explicitly in Page_Load on my RadScheduler, I get results back... Am I supposed to be calling DataBind() explicitly? I don't call it for RadGrid so I wasn't sure. Any idea why I'm getting no results back in my AppointmentInsert() event?

void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
{
     //Returns no records
     var aps = RadScheduler1.Appointments.GetAppointmentsInRange(e.Appointment.Start, e.Appointment.End);
}     


6 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 30 Sep 2010, 12:59 PM
Hi Michael Malone,

Are you trying to make a similar project as the "Occupied Timeslots" Demo. You can see how it works.

If you still need help - could you send me your project so I can inspect it and help you?

Thank you!

Kind regards,
Veronica Milcheva
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
0
Michael Malone
Top achievements
Rank 1
answered on 30 Sep 2010, 04:44 PM
I was indeed following that demo except my datasource is created and set in the code-behind from a List of IQuerable objects. It looks like I have to explicitly call DataBind() once my DataSource is set. 

void LoadDataSource()
{
    DrAppointment app = new DrAppointment();
 
    switch (RadScheduler1.SelectedView)
    {
        case SchedulerViewType.DayView:
            DBAppointments = app.GetAll(RadScheduler1.SelectedDate).ToList();
            break;
        case SchedulerViewType.WeekView:
            DBAppointments = app.GetAll().ToList();
            break;
        case SchedulerViewType.MonthView:
            DBAppointments = app.GetAll().ToList();
            break;
    }
         
    RadScheduler1.DataSource = DBAppointments;
    RadScheduler1.DataBind();
}
0
Veronica
Telerik team
answered on 06 Oct 2010, 11:05 AM
Hello Michael Malone,

Yes, you should call DataBind method of the control after setting DataSource or DataSourceID properties. This is a part of the ASP.NET binding mechanism.

All the best,
Veronica MIlcheva
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
0
Michael Malone
Top achievements
Rank 1
answered on 06 Oct 2010, 02:52 PM
Thanks you... one question though. Why don't I have to call DataBind() with RadGrid?
0
Veronica
Telerik team
answered on 11 Oct 2010, 04:30 PM
Hello Michael Malone,

DataBind() method is not called when you are binding to declarative data sources or advanced data binding (NeedDataSource). RadGrid could be binded also with simple data binding.  

Please note that it is important not to mix both ways.

All the best,
Veronica Milcheva
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
0
Michael Malone
Top achievements
Rank 1
answered on 14 Oct 2010, 03:39 PM
I was using the NeedsDataSource event... thanks
Tags
Scheduler
Asked by
Michael Malone
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Michael Malone
Top achievements
Rank 1
Share this question
or