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.
Unfortunately, activation email could not send to your email. Please try again.

Make the schedule readonly

Thread ID:

Created:

Updated:

Platform:

Replies:

132617 Sep 12,2017 09:24 AM Sep 13,2017 09:28 AM Windows Forms 1
loading
Tags: ScheduleControl
Nicolas Martin
Asked On September 12, 2017 09:24 AM

Hi,

I need to show some books made on my app into the scheduleControl.

So I linked a button to a new Form. As I don't want the uer to be able to change the events from the schedule, I canceled the  event showing the appointment form. But when I close the form I still have the messageBox asking if I want to discard changes. How can I disable this messageBox ?

I'd like also to display week-end in the WorkWeek view, is this possible ? 

Attachment: Capture_d’écran_(1)_1ca24d17.zip

Mohanraj Gunasekaran [Syncfusion]
Replied On September 13, 2017 09:28 AM

Hi Nicolas, 

Thanks for using Syncfusion product. 

Query 
Solution 
I linked a button to a new Form. As I don't want the uer to be able to change the events from the schedule, I canceled the event showing the appointment form. But when I close the form I still have the messageBox asking if I want to discard changes. How can I disable this messageBox ? 
In order to avoid the MessageBox showing when closing the form. SaveOnCloseBehaviorAction property can be used. Please refer to the below code example, 
 
Code example 
this.scheduleControl1.DataSource.SaveOnCloseBehaviorAction = SaveOnCloseBehavior.SaveWithoutPrompt; 
I'd like also to display week-end in the WorkWeek view, is this possible ?  
In order to display the week end in WorkWeek view, you can use the CustomWeek schedule view and SelectedDates property can be used to add the dates in ScheduleControl. Please refer to the below code example and the sample, 

Code example 
this.scheduleControl1.GetScheduleHost().Calendar.SelectedDates.Clear(); 
this.GetWeekDays(); 
 
private void GetWeekDays() 
{ 
    int count = 7;//No of days in week. 
    this.scheduleControl1.GetScheduleHost().Calendar.SelectedDates.BeginUpdate(); 
    DateTime theDate = this.scheduleControl1.GetScheduleHost().Calendar.DateValue; 
    while (theDate.DayOfWeek != this.scheduleControl1.Appearance.NavigationCalendarStartDayOfWeek) 
    { 
        theDate = theDate.AddDays(-1); 
    } 
 
    this.scheduleControl1.GetScheduleHost().Calendar.SelectedDates.Clear(); 
    while (count > 0) 
    { 
        this.scheduleControl1.GetScheduleHost().Calendar.SelectedDates.Add(theDate); 
        theDate = theDate.AddDays(1); 
        count--; 
    } 
    this.scheduleControl1.GetScheduleHost().Calendar.SelectedDates.EndUpdate(); 
} 
 
Note 
If you want to navigate the weeks using caption panel arrow. Please use the below code, 
 
Code example 
foreach (Control con in this.scheduleControl1.CaptionPanel.Controls) 
{ 
    if (con is ThemedScrollButton) 
    { 
        ThemedScrollButton button = con as ThemedScrollButton; 
        button.Click += button_Click; 
    } 
} 
 
void button_Click(object sender, EventArgs e) 
{ 
    ThemedScrollButton button = sender as ThemedScrollButton; 
            
    if (button.Text == "<")//Move to previous week 
    { 
        this.MoveInDirection(false); 
    } 
    else if (button.Text == ">") //Move to week forward 
    { 
        this.MoveInDirection(true); 
    } 
} 
 

Sample link: ScheduleControl 

Regards, 
Mohanraj G 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;