Regarding Data Binding between RadScheduler and MySQL

14 posts, 2 answers
  1. Phil
    Phil avatar
    5 posts
    Member since:
    Oct 2013

    Posted 31 Oct 2013 Link to this post

    For data binding in winform scheduler, i want to update database when the appointment is added, updated rather than when some update button is clicked.

    Currently, the documentations provided is perfectly describing how it work with button, and i love it. Nonetheless, i want to find better, and easy way to update appointment, so we can get rid of using update button.

    Is there any event property for radscheduelr that i can use in this condition? or Any other way to do this?

  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 05 Nov 2013 Link to this post

    Hi Daewoong,

    There are properties on the RadScheduler that will force a data update. To quote Ivan Todorov from this thread:

    "To reload the data from the database, you should use the Fill method of your table adapters to repopulate your datasets with data. When you do this, RadScheduler should automatically detect the changes and reflect them to the user interface. If this does not happen, then you can force an update by calling RadScheduler's DataBind method."

    Let us know if this helps. Feel free to ask any further questions you may have about the RadScheduler or any other RadControls.

    Regards,
    Master Chief

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Phil
    Phil avatar
    5 posts
    Member since:
    Oct 2013

    Posted 05 Nov 2013 Link to this post

    Well, I wrote bit jumbled up post, sorry for that.  I use data binding and it perfectly works when loading from database.

    What i want to do is that updating database without clicking button when client add appointment or edit appointment or delete it or dragging appointments.

    The documentations provides methods that works with button clicking after adding,editing deleting,dragging, or...(many other scheduler features) appointments. If i do not want to update database with button, i probably need to copy the codes for every event handling method, which is counter productive. So i am looking for any event properties in radscheduler that pops up when scheduler's appointment data is changed. Therefore, every time clients change data on scheduler, the program update database automatically without needs of client to click "update button".

    Is there any features in radscheduler?

  5. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 05 Nov 2013 Link to this post

    Are you trying to update after a user creates / edits / deletes an appointment? There are events triggered after all of these actions are done client side. You can access the RadScheduler's DataBind method inside of the AppointmentAdded and AppointmentDeleted methods. An example of this is shown here:

    private void radScheduler1_AppointmentAdded(object sender, Telerik.WinControls.UI.AppointmentAddedEventArgs e)
    {
          radScheduler1.DataBind();
    }

    Hopefully this helps you update your RadScheduler after a user adds or removes appointments.

    Regards,
    Master Chief
  6. Phil
    Phil avatar
    5 posts
    Member since:
    Oct 2013

    Posted 05 Nov 2013 Link to this post

    Yes, both of them perfectly work when you 'add' and 'delete' appointment, but it does not work when you dragging appointment or editing appointment. And i read all the properties and could not find related properties. Did i miss that property?
  7. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 06 Nov 2013 Link to this post

    There are AppointmentDropped and AppointmentMoved methods, but I cannot seem to find an event triggered when the appointment is edited.
  8. Phil
    Phil avatar
    5 posts
    Member since:
    Oct 2013

    Posted 07 Nov 2013 Link to this post

    so do we need to use update button for updating database when client edit appointment?
  9. Answer
    George
    Admin
    George avatar
    500 posts

    Posted 08 Nov 2013 Link to this post

    Hi Dawoong,

    Thank you for contacting us.

    Since RadScheduler uses ObservableCollection to store its appointments and every appointment implements the INotifyPropertyChanged interface, every time a property in an Appointment changes the CollectionChanged/Changing events are being fired. You can use them to track edits on appointments:
    void Appointments_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    {
        if (e.Action == NotifyCollectionChangedAction.ItemChanged)
        {
            Appointment app = e.NewItems.Count > 0 ? e.NewItems[0] as Appointment : null;
            if (app != null)
            {
            }
        }
    }

    You can subscribe as follows:
    this.scheduler.Appointments.CollectionChanged += Appointments_CollectionChanged;

    I hope this helps.

    PS. As this question concerns RadScheduler for WinForms, the thread was move to the WinForms forums.

    Regards,
    George
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Snehith
    Snehith avatar
    4 posts
    Member since:
    Sep 2014

    Posted 18 Sep 2014 in reply to George Link to this post

    I am using custom appointment form. How can i bind the data from mysql to the radscheduler? How can i show appointment by resources?

    Note: my appointment and resource table structure is different from the telerik.
      
  11. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 22 Sep 2014 Link to this post

    Hello Snehith,

    Thank you for writing.

    I have prepared a sample project for your convenience demonstrating how to bind the RadScheduler, use custom EditAppointmentDialog (email property is included) and group by resources. The sample data base back up file is included as well. Our Data Binding Walkthrough help article covers the most usual scenario with binding to a database in which appointments and resources are in a many-to-many relation. 

    If it is not suitable for your specific case and you have some specific data base structure, could you please provide some additional information about the exact appointments/resources tables's structure and their relation? Thus, we would be able to investigate the precise case and assist you further.

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  12. Snehith
    Snehith avatar
    4 posts
    Member since:
    Sep 2014

    Posted 24 Sep 2014 in reply to Dess Link to this post

    Hello Desislava,

    Thanks for reply.

    I tried with your example and trying to understand and implement in my application.
    Here i attach my appointment and resource tables and our custom appointment form.
    We don't main any extra table for appointmentresource like in telerik, while inserting a record into the appointment table we have a column  resource. A single appointment can have multiple resources .
  13. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 26 Sep 2014 Link to this post

    Hello Snehith,

    Thank you for writing back.

    You can refer to our Setting Appointment and Resource relations help article which is quite useful when you have only two tables for setting up data in scheduler. Please have a look at the attached sample project which demonstrates how to bind RadScheduler to a simpler data structure with two tables only. The back up file for the sample data base is included as well.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  14. Snehith
    Snehith avatar
    4 posts
    Member since:
    Sep 2014

    Posted 26 Sep 2014 in reply to Dess Link to this post

    Thanks Desislava,

    I will try with your input and get back to you if i have any more issue.

  15. Answer
    Dess
    Admin
    Dess avatar
    1609 posts

    Posted 01 Oct 2014 Link to this post

    Sure Snehith. Feel free to get back to us if you have any further questions.
     
    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready