Custom dataprovider without customizing the advance form

12 posts, 0 answers
  1. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 04 Feb 2011 Link to this post

    Hello Admin,
    I am a beginner in the web development and need to use telerik radscheduler in our website. I used the radscheduler with sqldatasource control. have been suggested not to use it. So, I want to use custom dataprovider but don't want to customize the advance form. Is it possible?  if yes then Could you please provide the demo project with only custom dataprovider  not the custom advance form? I have gone through some demos on custom dataprovider provided by you on some forums but all have customized advanceform. I also tried to use only custom dataprovider but failed. Also I need to add the Students And Lesson resources at runtime.
    My Appointments table contains following fields:
    AppointmentId
    Subject
    Start
    [End]
    LessonTypeId
    InstructorId
    CustomerId
    RecurrenceRule
    RecurenceParentId
    Description
    IsInactive
    IsDelivered
    IsEdited
    IsDeleted
    FlightHours
    GroundHours
    Comments
    ------------------------
    LessonTypeId , InstructorId, CustomerId are the resources.

    Help me.
    Please reply as soon as possible.

    Thanks in advance,
    Roshani
  2. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 07 Feb 2011 Link to this post

    Any one please......
  3. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 07 Feb 2011 Link to this post

    Hi Roshani,

    Please, review the Implementing A Provider topic. Note, that using a provider does not require you to use the advanced templates.

    You can add resources dynamically like this:
    protected void Page_Load(object sender, EventArgs e)
    {
      RadScheduler1.ResourceTypes.Add(new ResourceType("User"));
      RadScheduler1.Resources.Add(new Resource("User", "1", "Alex"));
      RadScheduler1.Resources.Add(new Resource("User", "2", "Bob"));
      RadScheduler1.Resources.Add(new Resource("User", "3", "Charlie"));
    }


    Best wishes,
    Peter
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  4. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 07 Feb 2011 Link to this post

    Thanks for the reply.

    I have built a sample application using custom database provider. First I just tried to populate the scheduler with appointments without adding the resources in the aspx page. It was working fine but after adding them it gives error. I have opened a support ticket  and attached the sample app.

    I have completed almost all the needed functionality  using SqlDataSource control. Using sqldatasource control we access data in the page itself. I just want to separate  the data access functionality from the presentation layer so want to remove sqldatasource control.  I think it can be achieved by using objectdatasource control and a class containing methods to Retrieve/Insert/Update/Delete appointments.  I have watched the Telerik TV demo but it contains the xmldataprovider and also don't contain the resources. Please provide the sample project for the scheduler using objectdatasource control and maintainig data from a sql table as above ?
    Please note that CustomerId and LessonTypeID  are my resources.

    Please reply soon.
    Thanks in advance,
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 07 Feb 2011 Link to this post


    Okay, we will review the sample you sent via a support ticket.

    In general, RadScheduler has AppointmentInsert/Edit/Delete server events, which allow you to successfully bind it to various data source types. For example, consider the Binding to Generic List demo.

    Also, the Getting Started topic uses an ObjectDataSource which could help you get a better understanding on this matter.


    Regards,
    Peter
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 07 Feb 2011 Link to this post

    Hello Peter,

    Thanks for the reply.

    Could you please provide a standalone application sample that uses the objectdatasource using sql database and similar type of requiremnts? It will be more helpful and easy to understand.

    Thanks in advance,
    Roshani
  7. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 09 Feb 2011 Link to this post

    Hello Peter,

    I have downloaded the carrental demo application. But it is too complex to understand. Could you please provide a simple application sample with similar type of requirements and using objectdatasource control.


    Thanks in advance.
  8. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 11 Feb 2011 Link to this post

    Hello,

    Anyone please...
  9. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 12 Feb 2011 Link to this post

    Hello,

     There is another problem I am facing now. Following code gives error "Object reference not set to an instance of an object." This code was working properly and now giving error.
    protected void rsAppointments_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
           {
               try
               {
                   //Customer ObjCustomer = null;
                   //EMail ObjEmail = null;
                   if (e.CommandName.Equals("Delivered"))
                   {
                       //Allows only past Appointments to be marked as delivered
                       if (e.Container.Appointment.Start <= DateTime.Now || e.Container.Appointment.End <= DateTime.Now)
                       {
                           Appointment appToEdit = rsAppointments.PrepareToEdit(e.Container.Appointment, rsAppointments.EditingRecurringSeries);
                          // ObjCustomer = new Customer(Convert.ToInt32(appToEdit.Resources.GetResourceByType("Students").Key.ToString()));
                           appToEdit.Attributes["IsInactive"] = "0";
                           appToEdit.Attributes["IsDelivered"] = "1";
                           rsAppointments.UpdateAppointment(appToEdit);                     
                           upScheduler.Update();
     
                       }
                   }
               }
               catch (Exception ex)
               {
                   string ErrorMessage = ex.Message;
                   SysLog.LogException(ex, MessageTypeEnum.DatabaseException, MessageSeverityEnum.Error);
               }
           }


    Which changes will make it working properly? Please reply soon.

    Thanks ,
    roshani
  10. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Feb 2011 Link to this post

    Hi Roshani,

    I tested the case, but there was no error with my sample. Please, try it and modify it so that the error occurs.


    Regards,
    Peter
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  11. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 24 Feb 2011 Link to this post

    Hello Peter,
    I am facing another issue. As given in the rental car demo, I have group scheduler by instructor resource. I added resource Instructors at the design time but provided datasource at runtime in the pageload event as given below:

    rsAppointments.ResourceTypes[0].DataSource = GetInstructorList();
    rsAppointments.ResourceTypes[0].ForeignKeyField = "InstructorId";
    rsAppointments.ResourceTypes[0].KeyField = "InstructorId";
    rsAppointments.ResourceTypes[0].TextField = "NameString";

    For displaying the images of the instructor in the resource header template, I have used the following code:

    protected void rsAppointments_DataBound(object sender, EventArgs e)
    {
      foreach (Resource resource in rsAppointments.Resources.GetResourcesByType("Instructors"))
      {
          resource.Attributes["Image"] = DataBinder.Eval(resource.DataItem, "Photo") as String;
      }
    }

    When the page is loaded first, it displays the images of the instructors in the resource header but when i navigate to past/future dates the images does not get displayed. Please see the attached screenshots. I am unable to track the reason of this behaviour. Please provide the solution.

    Also is there any way to limit the resources for the view. As the no of the instructors will increase, the scheuler view will not be that much clear. So I want to display the schedule for say 5 instructors at a time. I think this functionality is available in the windows scheduler as given below in the following blog:
    http://blogs.telerik.com/blogs/posts/09-11-05/radcontrols_for_winforms_q3_2009_-_radscheduler_resource_grouping.aspx

    radScheduler1.GroupType = GroupType.Resource;
    radScheduler1.ActiveView.ResourcesPerView = 3;

    I also want something like this. How to achive this?

  12. roshani
    roshani avatar
    45 posts
    Member since:
    Dec 2010

    Posted 25 Feb 2011 Link to this post

    Anyone Please..

    Thanks and Regards,
    Roshani
Back to Top