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

Documentation ?

3 Answers 625 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jon Hobbs
Top achievements
Rank 1
Jon Hobbs asked on 07 Jul 2007, 08:54 PM
Hi Guys ?

I've beern really looking forward to the scheduler as I have 2 applications waiting for this kind of functionality but now it's here I have no idea how to use it :) All I need to do is get some data from a database and show them on a static calendar, there is no need for inserts or updates at this point.

First I tried just putting an empty scheduler on the page but got the following error...

DataKeyField, DataSubjectField, DataStartField and DataEndField are required for databinding


So I assume it's not possible to leave it empty, but how do you bind data to it  ? I prefer not to use datasource controls. I'd like to put something in the page_load like this...

MyScheduler.Datasource = MyDataTable
MyScheduler.Databind()

Is it possible to just bind a datatable to a Scheduler this way ?

Next Question - Would it be possible to publish an example of a database table or some XML showing the format that the appointments should be kept in, for those of us that don't understand the iCal format, and still don't get it after trying numerous websites about it ;)

Thanks, Jon


3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 09 Jul 2007, 08:08 AM
Hi Jon Hobbs,

Thank you for your feedback.

Binding in such way is certainly possible. You can bind to any object that implements IListSource (such as DataTable) or IEnumerable (List<T>, Array, etc.).  You still need to specify which column/property to use, though.

So, in your example the RadScheduler tag will have to look like this:
<telerik:RadScheduler runat="server" ID="RadScheduler1" 
    Width="100%" EnableEmbeddedSkins="True" Skin="Mac" 
    DayStartTime="08:00:00" DayEndTime="18:00:00" TimeZoneOffset="03:00:00" 
    DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
</telerik:RadScheduler> 
 

Presuming that your table has columns with names "ID", "Subject", etc.

The drawback of this approach is that without additional code this will result in read-only data binding and the changes will not propagate back to the data table. The code to achieve two-way data binding is not that complex (see the example "Binding To Generic List"), but there are better alternatives.

RadScheduler supports the provider model which offer an alternative to the data source controls. As an example we have included a provider that you can use right away to store the Appointments in an XML file. Check it out - "XML Scheduler Provider" example under the "Populating With Data" category. I hope this answers the XML part of your second question too. The XML schema used is specific to the provider, though. Another provider might use completely different schema to store the information.

As for the sample database schema - these are the required fields, the names can vary as long as you match them with the corresponding properties of RadScheduler:
  • ID: int, identity, primary key
  • Subject: nvarchar, not null, as long as you need it to be
  • Start, datetime, not null
  • End, datetime, not null
  • (The following two are needed if you want to support recurring events)
  • RecurrenceRule: varchar(512), null (in extreme conditions might get longer)
  • RecurrenceParentID, int, null, foreign key constraint pointing to the primary key
Knowledge about the iCal is not required at all, although it used internally to store the recurrence rule.

I suggest that you also read the help file (Controls/RadScheduler/DataBinding) for an overview and some examples.

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jon Hobbs
Top achievements
Rank 1
answered on 09 Jul 2007, 09:53 AM
Hi,

Thanks for your answer, helpful as always. As always it has thrown up some more questions though.....

1) In the xml example you seem to keep the xml provider in the session, is this necessary if you are only using it on one page across postbacks ?

2) There is no XML tab on the example so I can't see the fot, i tried various paths to the file App_Data/Appointments.xml but couldn't seem to find the root of your app and couldn't download the file.

3) given that I want to use a database instead of xml i assume i am going to have to do it using Datasource control. In your first example though you use <sds:SessionDataSource> which is presumably a custom control you have written for your own site ? How would we use it ?

4) I couldn't find the documentation for the scheduler, it's not online here - http://www.telerik.com/help/radcontrols/prometheus/ , was it unpacked as part of the .exe i downloaded ?

Again, sorry for the newbie questions :)
0
T. Tsonev
Telerik team
answered on 09 Jul 2007, 01:44 PM
Hi Jon Hobbs,

Straight to your questions:
  1. We use the Session object and the additional logic only for the purpose of the demo. This way each user can play with the data in the demo, but the changes are not persisted. Try deleting an appointment and see that when you return to the page the appointment will be there again.
  2. The XML file is not accessible (security settings) - you will find the sample file attached, it is in the documentation as well.
  3. SessionDataSource is actually a specialized SqlDataSource modified to achieve the behavior described in point 1. You should use SqlDataSource in its place, but if you find it useful for some reason, its source code is included in the App_Code folder of the QSF.
  4. Thanks for the heads-up, we have uploaded the draft documentation at http://www.telerik.com/help/radcontrols/prometheus-futures/ . You can read the CHM file unpacked by the installer.
In a production system you will normally configure the XmlSchedulerProvider in the web.config file and just set the ProviderName on the RadScheduler instances. Check out the documentation for details.

Thank you again for your feedback, it has helped us in identifying weak points in our documentation and examples. You will receive 500 Telerik points for your contribution.

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Jon Hobbs
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Jon Hobbs
Top achievements
Rank 1
Share this question
or