Defining Provider in Config File

4 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 02 Dec 2008 Link to this post


    I defined the custom scheduler provider (inheriting from DbSchedulerProviderBase) in the configuration file.  But the Provider property of the Scheduler control is null.  So do I have to do something to load the provider from the config file, or do I do something else?  I'm not sure if there is a method I have to call first, or if that is supposed to happen automatically.

  2. Peter
    Peter avatar
    6637 posts

    Posted 03 Dec 2008 Link to this post

    Hello Brian,

    Please, make sure you set the ProviderName property of RadScheduler. Here is how it is set in the online example which you referred to:

     <telerik:RadScheduler runat="server" ID="RadScheduler1" 
                        ProviderName="ReadOnlySchedulerData" ReadOnly="true" ...> 

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
  4. pucsoftware
    pucsoftware avatar
    24 posts
    Member since:
    Sep 2006

    Posted 17 Sep 2009 Link to this post

    I am trying to use my inherited class I created based off the DbSchedulerProviderBase. I used the example to get this working and everything works when I bind it to the scheduler. However, what I need to do is open up a new window to a single appointment and allow users to export the item if they want. I was trying to manually create an Appointment item by creating a method in my scheduler provider class to just populate and return that single item. However, I can't instantiate an instance of the class. I can call the method but the OpenConnection() method fails with a value is null exception. The Scheduler component must be initializing the class properly but I can't see how I can do this outside using the component. Can this be done?
  5. T. Tsonev
    T. Tsonev avatar
    2760 posts

    Posted 22 Sep 2009 Link to this post


    The DbSchedulerProviderBase class relies on the Initialize method to read the settings from the web.config file and this method indeed is not called in this scenario.

    One option is to use the System.Web.Configuration.ProvidersHelper class to instantiate the provider:

    using System.Web.Configuration;
    using System.Configuration;
    using Telerik.Web.UI;

    RadSchedulerConfigurationSection section = (RadSchedulerConfigurationSection) WebConfigurationManager.GetSection("telerik.web.ui/radScheduler");
    if (section != null)
        ProviderSettings providerSettings = section.AppointmentProviders["XmlSchedulerProvider"];
        MyProvider provider = (MyProvider) ProvidersHelper.InstantiateProvider(providerSettings, typeof(SchedulerProviderBase));

    Another option is to create a new constructor that takes a connection string and initialize the DbFactory and ConnectionString properties in it:

    public MyProvider(string connectionStringName)
        ConnectionStringSettings connectionSettings = ConfigurationManager.ConnectionStrings[connectionStringName];
        DbFactory = DbProviderFactories.GetFactory(connectionSettings.ProviderName);
        ConnectionString = connectionSettings.ConnectionString;

    However, the first approach is more future-proof and I'd recommend using it instead.

    Best wishes,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top