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

RadSheduler - FindById helper function

7 Answers 166 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Roman
Top achievements
Rank 1
Roman asked on 29 Jan 2009, 11:54 AM
Hi!

I'm new in ASP.NET, so excuse me for stupid question, but i really don't understand.
I tried to work with RadSheduler by this tutorial. And everything is ok, but i don't understand, why when i ran an application, it gives me an error "The name 'appointments' does not exist in the current context" =/

Best wishes,
Roman

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 29 Jan 2009, 01:10 PM
Hi Roman,

Can you send us a small working demo of the problem which we can test locally? To attach files, you will need to open a support ticket.

Greetings,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Roman
Top achievements
Rank 1
answered on 29 Jan 2009, 05:45 PM
Hi!

Here is my small demo I hope you will understand this :)

Roman.
0
Accepted
Peter
Telerik team
answered on 30 Jan 2009, 12:08 PM
Hi Roman,

Thanks for the demo. It helped us find out what the problem is. In the FindById helper function, "appointments" should be with capital A:
 private AppointmentInfo FindById(string ID)  
    {  
        foreach (AppointmentInfo ai in Appointments)  
        {  
            if (ai.ID == ID)  
            {  
                return ai;  
            }  
        }  
        return null;  
    } 

Appointments is the list defined by this code:
private List<AppointmentInfo> Appointments  
        {  
            get 
            {  
                List<AppointmentInfo> sessApts = Session[AppointmentsKey] as List<AppointmentInfo>;  
                if (sessApts == null)  
                {  
                    sessApts = new List<AppointmentInfo>();  
                    Session[AppointmentsKey] = sessApts;  
                }  
 
                return sessApts;  
            }  
        } 


Best wishes,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Roman
Top achievements
Rank 1
answered on 30 Jan 2009, 02:51 PM
Thank you very much!
0
Roman
Top achievements
Rank 1
answered on 30 Jan 2009, 03:42 PM
Excuse for my persistence, but only have understood with one problem as I had another. I tried to understand with her, reading lessons and looking through similar errors at a forum, but it has not helped me. Can you help me once more. My error:

Both DataSource and DataSourceID are defined on 'RadScheduler1'.  Remove one definition.

My demo files

Greetings,
Roman
0
Accepted
Peter
Telerik team
answered on 03 Feb 2009, 11:06 AM
Hi Roman,

The error message describes what the problem is. In Shedulet.ascx you set the DataSourceID:

<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="End"   
DataKeyField="ID" DataRecurrenceField="RecurrenceRule"   
DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="SqlDataSource1"  

And in code behind you set: RadScheduler1.DataSource = Appointments;

You should either set the DataSource or the DataSourceID property, but you cannot set both.


Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Roman
Top achievements
Rank 1
answered on 03 Feb 2009, 12:32 PM
Thanks!
Tags
Scheduler
Asked by
Roman
Top achievements
Rank 1
Answers by
Peter
Telerik team
Roman
Top achievements
Rank 1
Share this question
or