We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Schedule control and mysql

Is it possible to connect the schedule control with my existing mysql database?

And also how to get the data from schedule control to the mysql database without using xml? 

thanks and more power to you guys

16 Replies

MG Mohanraj Gunasekaran Syncfusion Team October 26, 2016 10:17 AM UTC

Hi Mike, 
 
Thanks for using Syncfusion products.  

We have created a sample for adding the SQL data into the Schedule control as per your requirement. In this sample we have populated the ScheduleControl with the sql database. Please refer to the following sample,   

Sample Link: ScheduleControl 

Note: 
To work with the SQL data at your client machine, please modify the connection string by creating a data base using the SQL Express and add the table “ScheduleData” like the attached local db file.  
  
Regards, 
Mohanraj G. 



MI mike October 27, 2016 01:40 AM UTC

Many thanks for this!!!

I have additional question though, how do I change the format of the text shown in the calendar, month view?
Let's say, the item is "Birthday 10:00", I just want it to display the "Birthday" without the time.  Is it possible? 

Again thank you very much for your help!


MI mike replied to mike October 27, 2016 02:00 AM UTC

Many thanks for this!!!

I have additional question though, how do I change the format of the text shown in the calendar, month view?
Let's say, the item is "Birthday 10:00", I just want it to display the "Birthday" without the time.  Is it possible? 

Again thank you very much for your help!

I just found it, it's the WeekMonthItemFormat property... anyway another question, is it possible to change the forecolor of each item, having different textcolors depending on their type? thanks again


MI mike October 27, 2016 05:33 AM UTC

Another question, is it possible to catch the navigation calendar event?  I'm using a customized context menu and I want to add an Item if right clicked a date on the navigation calendar.  the problem is I don't know how to get the selected date/item on the navigation calendar.  Is it also possible to add a marker on the navigation calendar if there is an event on that day?  Thanks thanks


MG Mohanraj Gunasekaran Syncfusion Team October 27, 2016 12:00 PM UTC

Hi Mike, 

Thanks for your update, 

Please find the responses for your queries 
is it possible to change the forecolor of each item, having different textcolors depending on their type? 

You can achieve your requirement using TextColor property in ScheduleGrid.QueryCellInfo event. Please refer the below code snippet and refer the below attached sample, 

Code snippet 
this.scheduleControl1.GetScheduleHost().QueryCellInfo += Form1_QueryCellInfo; 
ScheduleViewType type; 
void Form1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) 
{ 
    type = this.scheduleControl1.ScheduleType; 
    if (type == ScheduleViewType.Month && e.ColIndex % 2 == 0 && e.RowIndex > 0) 
        e.Style.TextColor = Color.Red;    
} 
 
I'm using a customized context menu and I want to add an Item if right clicked a date on the navigation calendar.  the problem is I don't know how to get the selected date/item on the navigation calendar 

In order to get the selected item, you can use the ScheduleGrid.SelectedAppointments property. Please refer the below KB link, 

KB link 
Get the selected appointments 

Add the new appoointments 

Is it also possible to add a marker on the navigation calendar if there is an event on that day? 

The marker support available only for metro theme. So if you want marker for appointments, please use the Metro theme for ScheduleControl. Please refer the below code snippet, 

Code snippet 
scheduleControl1.Appearance.VisualStyle = Syncfusion.Windows.Forms.GridVisualStyles.Metro;   
 


Sample link: ScheduleGrid 

Note 
Did you ask the customization for Navigation calendar (Right side of the schedule grid)? Please refer the attached screenshot 


Regards, 
Mohanraj G. 



MI mike October 28, 2016 01:30 AM UTC

"Did you ask the customization for Navigation calendar (Right side of the schedule grid)? Please refer the attached screenshot "

Yup, I'm referring to the navigation calendar on the sides.  I can already get the selected date on the (appointment?) calendar using ScheduleAppointmentClick but what I need is the one from the navigation calendar (calendar on the sides).  

By the way, thanks for the awesome help on the other items...

Also, is it possible to add recurring appointments programatically?  thanks


MI mike replied to mike October 28, 2016 07:17 AM UTC

"Did you ask the customization for Navigation calendar (Right side of the schedule grid)? Please refer the attached screenshot "

Yup, I'm referring to the navigation calendar on the sides.  I can already get the selected date on the (appointment?) calendar using ScheduleAppointmentClick but what I need is the one from the navigation calendar (calendar on the sides).  

By the way, thanks for the awesome help on the other items...

Also, is it possible to add recurring appointments programatically?  thanks

I already got the recurring appointments by using the "RecurringList"...

The only problem I have is with regards to the side navigation calendar, and also, the snippet you sent me with regards to the textcolor applies to the whole cell.
Is it possible to change the style of the contents/subject only of that cell not including the dates?  And also is it possible to apply text styles only to those cells that have contents/subjects?  Again, thanks for your continued support


MI mike October 28, 2016 08:51 AM UTC

How do I change the metro color theme?  Sorry for the numerous questions...


AK Adhikesevan Kothandaraman Syncfusion Team October 28, 2016 05:17 PM UTC

HI Mike, 

Thanks for your update. 

Please refer to the following response for your queries, 
  
I can already get the selected date on the (appointment?) calendar using ScheduleAppointmentClick but what I need is the one from the navigation calendar (calendar on the sides). 
 
If you want to get the selected date from the navigation panel, you can use the CalenderGrid.CellClick event as of follows, 

Code snippet: 
this.scheduleControl1.Calendar.CalenderGrid.CellClick += CalenderGrid_CellClick; 
void CalenderGrid_CellClick(object sender, Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs e) 
{ 
    //Display the selected date in the navigation panel 
    MessageBox.Show(this.scheduleControl1.Calendar.CalenderGrid[e.RowIndex, e.ColIndex].Text.ToString()); 
} 
 
Is it possible to change the style of the contents/subject only of that cell not including the dates? 
 
If you want to change the style navigation panel dates that has an appointment, refer to the following Kb document,  
is it possible to add recurring appointments programatically? 
To add the multi span day appointment in a schedule control, you can use the AddSpanAppointment method. Please refer to the following code snippet to add the multi span day appointment in schedule control,   
 Code Snippet:   
ArrayListDataProvider dataprovider = new Syncfusion.Schedule.ArrayListDataProvider();   
IScheduleAppointment appointment = dataprovider.NewScheduleAppointment();         
   
appointment = dataprovider.NewScheduleAppointment();   
appointment.StartTime = DateTime.Now;   
appointment.EndTime = DateTime.Now.AddDays(4);   
appointment.AllDay = true;   
appointment.Subject = "Leave";   
appointment.LabelValue = 1;   
appointment.AllowResize = false;   
appointment.AllowDrag = false;   
  
//Convert the appointment as the recurrence schedule appointment    
IRecurringScheduleAppointment recurrenceAppointment = appointment as IRecurringScheduleAppointment;        
//Add the multi-span day appointment to the schedule control   
this.scheduleControl1.AddSpanAppointment(recurrenceAppointment, dataprovider);   
this.scheduleControl1.DataSource = dataprovider;   

How do I change the metro color theme? 
If you want to change the colors of the metro theme, you can use the Appearance properties of the schedule control, 

code snippet: 
// Setting metro theme for schedule control 
this.scheduleControl1.Appearance.VisualStyle = Syncfusion.Windows.Forms.GridVisualStyles.Metro; 
 
// Customize the appearance of navigation calendar 
this.scheduleControl1.Appearance.NavigationCalendarWeekNumberColor = Color.Green; 
this.scheduleControl1.Appearance.NavigationCalendarTextColor = Color.Red; 


 



Regards, 
Adhi 



MI mike November 2, 2016 01:58 AM UTC

Great help Sir, thanks a lot.  last question though (hopefully), When I click a date on the side navigation calendar, the main calendar changes view from month to week.  How do I cancel the changing of the ScheduleViewType when I click on the side nav calendar and still get the selected date?  Thanks a lot sir


MI mike November 2, 2016 04:00 AM UTC

Is it also possible to catch the ScheduleViewType event (PerformSwitchToScheduleViewTypeClick) of the schedule control?
Because I noticed that when I change the ScheduleViewType let's say from ScheduleViewType.Week to ScheduleViewType.Month, all the formatting (colors) I made are being reverted back to default.  What I want is to capture the event when changing the scheduleviewtype so I can set the calendar formats after changing the view. again, thank you so much for your help


PM Piruthiviraj Malaimelraj Syncfusion Team November 2, 2016 01:33 PM UTC

Hi Mike, 

Thanks for the update. 

We have analyzed your scenario and created the simple sample. The schedule control does not have direct support to restrict the view changing while selecting the date from calendar. In order to restrict the view changing , SwitchViewStyle property can be used in CalenderGrid.MouseDown and ScheduleContextMenuClick events. The SetupContextMenu event will be triggered whenever the view type is changed. Please make use of the below code, 
 
Code example 
//Form() 
this.scheduleControl1.SwitchViewStyle = false; 
 
this.scheduleControl1.Calendar.CalenderGrid.MouseDown += CalenderGrid_MouseDown; 
this.scheduleControl1.ScheduleContextMenuClick += scheduleControl1_ScheduleContextMenuClick; 
 
void CalenderGrid_MouseDown(object sender, MouseEventArgs e) 
{ 
    this.scheduleControl1.SwitchViewStyle = false; 
} 
void scheduleControl1_ScheduleContextMenuClick(object sender, ScheduleContextMenuClickEventArgs e) 
{ 
    this.scheduleControl1.SwitchViewStyle = true; 
} 
 
//Triggers the event while view type is changing. 
this.scheduleControl1.SetupContextMenu += new CancelEventHandler(scheduleControl1_SetupContextMenu); 
void scheduleControl1_SetupContextMenu(object sender, CancelEventArgs e) 
{ 
    //your code 
} 
 
Sample link 

Regards, 
Piruthiviraj 



MI mike November 8, 2016 08:36 AM UTC

Thanks so much for these it really helped me a lot....
Anyway, probably my last question, how do you wrap the text in a cell?
I have an event in a calendar and the contents are not showing up all and I want it to wrap so all text are visible, if possible, it will fit automatically in the cell.

thanks thanks thanks


PM Piruthiviraj Malaimelraj Syncfusion Team November 9, 2016 01:42 PM UTC

Hi Mike, 

Thanks for the update. 

We have analyzed your scenario. We are little bit unclear with your scenario about which text should be wrapped whether the appointment subject details or other. Could you please provide us with the screen shot of your scenario. It would be more useful for us to provide the exact solution at the earliest. 

Regards, 
Piruthiviraj 



MI mike November 10, 2016 03:07 AM UTC

I want to wrap the appointment subject seen on the calendar (center) area

Please see attached file

Attachment: screen1_b772c1c6.zip


PM Piruthiviraj Malaimelraj Syncfusion Team November 10, 2016 01:22 PM UTC

Hi Mike, 

Thanks for the update. 

We regret to let you know that the schedule control does not have support for wrapped text. As per the current support in schedule control, this is the default behaviour. The appointment subject will be placed within the cell size. The whole string can be viewed by referring the tool tip of that appointment as like below, 

 

Regards, 
Piruthiviraj

Loader.
Live Chat Icon For mobile
Up arrow icon