Get the following error "Provider name cannot be null or empty."

3 posts, 0 answers
  1. Faifal
    Faifal avatar
    4 posts
    Member since:
    May 2011

    Posted 06 Feb 2012 Link to this post

    I am getting the following error when I run a web page using RadScheduler Custom Provider:

    Provider name cannot be null or empty.

    I placed in the web config exactly what is supplied in the demo as well as examples posted on the site and I am still getting the above error.

    Here is what is within my web.config:

    <?xml version="1.0"?><br>
    <configuration><br>
      <configSections><br>
        <sectionGroup name="telerik.web.ui"><br>
          <section name="radScheduler" type="Telerik.Web.UI.RadSchedulerConfigurationSection, Telerik.Web.UI, PublicKeyToken=121fae78165ba3d4" allowDefinition="MachineToApplication"/><br>
        </sectionGroup><br>
      </configSections><br>
      <telerik.web.ui><br>
        <radScheduler defaultAppointmentProvider="Integrated"><br>
          <appointmentProviders><br>
            <add name="ClassSchedSchedulerData" type="Scheduler3.RDSchedulerProvider" persistChanges="false"/><br>
          </appointmentProviders><br>
        </radScheduler><br>
      </telerik.web.ui><br>
      <appSettings><br>
        <add key="Telerik.ScriptManager.TelerikCdn" value="Disabled"/><br>
        <add key="Telerik.StyleSheetManager.TelerikCdn" value="Disabled"/><br>
      </appSettings><br>
      <system.web><br>
        <compilation debug="true" targetFramework="4.0"><br>
          <assemblies><br>
            <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><br>
            <add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><br>
            <add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><br>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/><br>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><br>
            <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><br>
            <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><br>
            <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/><br>
            <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><br>
          </assemblies><br>
        </compilation><br>
        <pages><br>
          <controls><br>
            <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/><br>
          </controls><br>
        </pages><br>
        <httpHandlers><br>
          <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/><br>
          <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/><br>
          <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/><br>
          <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/><br>
          <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/><br>
        </httpHandlers><br>
        <httpModules/><br>
      </system.web><br>
      <system.webServer><br>
        <validation validateIntegratedModeConfiguration="false"/><br>
        <modules runAllManagedModulesForAllRequests="true"/><br>
        <handlers><br>
          <remove name="ChartImage_axd"/><br>
          <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode"/><br>
          <remove name="Telerik_Web_UI_SpellCheckHandler_axd"/><br>
          <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode"/><br>
          <remove name="Telerik_Web_UI_DialogHandler_aspx"/><br>
          <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode"/><br>
          <remove name="Telerik_RadUploadProgressHandler_ashx"/><br>
          <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode"/><br>
          <remove name="Telerik_Web_UI_WebResource_axd"/><br>
          <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode"/><br>
        </handlers><br>
      </system.webServer><br>
    </configuration><br>




    This is the following code within my provider:

    using System;<br>
    using System.Collections.Generic;<br>
    using System.Linq;<br>
    using System.Web;<br>
    using Telerik.Web.UI;<br>
    using System.Data;<br>
    using SchedEZ.DataAccess;<br>
    using SchedEZ.Utilities;<br>
    <br>
    <br>
    namespace Scheduler3<br>
    {<br>
        public class RDSchedulerProvider : SchedulerProviderBase    <br>
        {<br>
    <br>
    <br>
            #region Declarations<br>
    <br>
    <br>
            private IDictionary<int, Resource> _staff;<br>
            private IDictionary<int, Resource> _students;<br>
            private IDictionary<int, Resource> _equipments;<br>
            private IDictionary<int, Resource> _buildingRooms;<br>
    <br>
    <br>
            private Boolean _persistChanges = false;<br>
    <br>
    <br>
            public enum eResourceType<br>
            {<br>
                BuildingRoom = 0,<br>
                Staff = 1,<br>
                Equipment = 2,<br>
                Student = 3<br>
            }<br>
    <br>
    <br>
            #endregion<br>
    <br>
    <br>
            #region Properties<br>
    <br>
    <br>
            #endregion<br>
    <br>
    <br>
            #region General Code<br>
    <br>
    <br>
            public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)<br>
            {<br>
                if (config == null)<br>
                {<br>
                    throw new ArgumentNullException("config");<br>
                }<br>
    <br>
    <br>
                string persistChanges = config["persistChanges"];<br>
                if (!string.IsNullOrEmpty(persistChanges))<br>
                {<br>
                    if (!bool.TryParse(persistChanges, out _persistChanges))<br>
                    {<br>
                        throw new Exception("Invalid value for PersistChanges attribute. Use 'True' or 'False'.");<br>
                    }<br>
                }<br>
                else<br>
                {<br>
                    _persistChanges = true;<br>
                }<br>
    <br>
    <br>
            }<br>
    <br>
    <br>
            public override IDictionary<ResourceType, IEnumerable<Resource>> GetResources(ISchedulerInfo schedulerInfo)<br>
            {<br>
                Dictionary<ResourceType, IEnumerable<Resource>> resCollection = new Dictionary<ResourceType, IEnumerable<Resource>>();<br>
    <br>
    <br>
                var myInfo = schedulerInfo as RDSchedulerInfo;<br>
                int classSchedID = myInfo.ClassSchedID;<br>
    <br>
    <br>
                // load the resources<br>
                if (_staff == null)<br>
                    _staff = ResourceStaff.loadResources(classSchedID);<br>
    <br>
    <br>
                if (_equipments == null)<br>
                    _equipments = ResourceEquipment.loadResources(classSchedID);<br>
    <br>
    <br>
                if (_students == null)<br>
                    _students = ResourceStudent.loadResources(classSchedID);<br>
    <br>
    <br>
                if (_buildingRooms == null)<br>
                    _buildingRooms = ResourceBuildingRoom.loadResources(classSchedID);<br>
    <br>
    <br>
    <br>
    <br>
                resCollection.Add(new ResourceType(Enum.GetName(typeof(eResourceType), eResourceType.Staff), true), _staff.Values);<br>
                resCollection.Add(new ResourceType(Enum.GetName(typeof(eResourceType), eResourceType.Student), true), _students.Values);<br>
                resCollection.Add(new ResourceType(Enum.GetName(typeof(eResourceType), eResourceType.BuildingRoom), false), _buildingRooms.Values);<br>
                resCollection.Add(new ResourceType(Enum.GetName(typeof(eResourceType), eResourceType.Equipment), true), _equipments.Values);<br>
    <br>
    <br>
                return resCollection;<br>
            }<br>
    <br>
    <br>
            public override IEnumerable<Appointment> GetAppointments(ISchedulerInfo schedulerInfo)<br>
            {<br>
                var myInfo = schedulerInfo as RDSchedulerInfo;<br>
                int classSchedID = myInfo.ClassSchedID;<br>
    <br>
    <br>
                List<Appointment> appointments = new List<Appointment>();<br>
    <br>
    <br>
                DataSet ds = ClassSchedWeekDayTime.getDataView_ByClassSchedID(classSchedID);<br>
    <br>
    <br>
                if (!ds.IsEmpty())<br>
                {<br>
                    foreach(DataRow dr in ds.Tables[0].Rows)<br>
                    {<br>
                        // create an appointment based on the data collected<br>
                        Appointment appt = ClassSchedule.addAppointment(dr);<br>
    <br>
    <br>
                        // load resources<br>
                        LoadResources(appt);<br>
    <br>
    <br>
                        // add to the appointments list<br>
                        appointments.Add(appt);<br>
                    }<br>
    <br>
    <br>
                }<br>
    <br>
    <br>
                return appointments;<br>
            }<br>
    <br>
    <br>
    <br>
    <br>
            private void LoadResources(Appointment apt)<br>
            {<br>
                // set the resource for each type<br>
    <br>
    <br>
                //Student<br>
                // students will be in every class schedule<br>
                foreach (KeyValuePair<int, Resource> res in _students)<br>
                    apt.Resources.Add(res.Value);<br>
    <br>
    <br>
                //Staff<br>
                List<Staff> sf = ResourceStaff.FindByID(apt.ID.toInt());<br>
                if (!sf.IsEmpty())<br>
                {<br>
                    foreach (Staff itm in sf)<br>
                        apt.Resources.Add(_staff[itm.StaffId]);<br>
                }<br>
    <br>
    <br>
                //Equipment<br>
                List<Equipment> eq = ResourceEquipment.FindByID(apt.ID.toInt());<br>
                if (!eq.IsEmpty())<br>
                {<br>
                    foreach (Equipment itm in eq)<br>
                        apt.Resources.Add(_equipments[itm.EquipmentId]);<br>
                }<br>
    <br>
    <br>
                //Equipment<br>
                List<BuildingRoom> br = ResourceBuildingRoom.FindByID(apt.ID.toInt());<br>
                if (!br.IsEmpty())<br>
                {<br>
                    foreach (BuildingRoom itm in br)<br>
                        apt.Resources.Add(_buildingRooms[itm.BuildingRoomID]);<br>
                }<br>
    <br>
    <br>
            }<br>
    <br>
    <br>
            public override void Insert(ISchedulerInfo schedulerInfo, Appointment appointmentToInsert)<br>
            {<br>
                base.Insert(schedulerInfo, appointmentToInsert);<br>
            }<br>
    <br>
    <br>
            public override void Update(ISchedulerInfo schedulerInfo, Appointment appointmentToUpdate)<br>
            {<br>
                base.Update(schedulerInfo, appointmentToUpdate);<br>
            }<br>
    <br>
    <br>
            public override void Delete(ISchedulerInfo schedulerInfo, Appointment appointmentToDelete)<br>
            {<br>
                base.Delete(schedulerInfo, appointmentToDelete);<br>
            }<br>
    <br>
    <br>
            #endregion<br>
        }<br>
    <br>
    <br>
    }<br>


    I really need help with this. A quick response to my issue would be greatly appreciated...

    thanks in advance


  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 10 Feb 2012 Link to this post

    Hi Faifal,

    Try implementing the Name property (it is defined in the base class) , however, it can be overriden. Also try calling the base initialize method. One of these should solve the problem.

    Please note that forum posts does not have guaranteed  response time and if there is an urgent issue it is best to submit a support tiket.

    Greetings,
    Genady Sergeev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. xtremex xploit
    xtremex xploit avatar
    2 posts
    Member since:
    Oct 2009

    Posted 04 Nov 2015 in reply to Genady Sergeev Link to this post

    You need to call the base...

     

            public override void Initialize(string name, NameValueCollection config)
            {
                base.Initialize(name, config);

     

        
Back to Top