This is a migrated thread and some comments may be shown as answers.

Disable the "dateStart" and "dateEnd" fields on the AppointmentEditForm

5 Answers 38 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 20 Aug 2011, 03:21 PM
Hello, i was curious if there is any special way that i need to implement inorder to Disable (.enabled = false) the dateStart and dateEnd fields ont he edit form.  i want to disallow the user from editing these fields if the appointment is in the past and settings then everywhere i have tried so far is having no effect.  timeStart and timeEnd were successfully disabled using normal methods.

5 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 22 Aug 2011, 09:20 AM
Hello Chad,

Thank you for contacting us.

You can disable these fields by overriding the behavior of the default dialog and replacing it in the  AppointmentEditDialogShowing event. Here is a code sample that demonstrates this:

public class EditDialogDisabledFields : EditAppointmentDialog
{
    protected override void OnShown(EventArgs e)
    {
        base.OnShown(e);
 
        if (Appointment.End < DateTime.Now)
        {
            this.dateStart.Enabled = false;
            this.timeStart.Enabled = false;
            this.dateEnd.Enabled = false;
            this.timeEnd.Enabled = false;
        }
        else
        {
            this.dateStart.Enabled = true;
            this.timeStart.Enabled = true;
            this.dateEnd.Enabled = true;
            this.timeEnd.Enabled = true;
        }
    }
}
 
 
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        this.radScheduler1.AppointmentEditDialogShowing += new EventHandler<AppointmentEditDialogShowingEventArgs>(radScheduler1_AppointmentEditDialogShowing);           
    }
     
    void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
    {
        e.AppointmentEditDialog = new EditDialogDisabledFields();
    }
}

I hope you find this useful. Feel free to contact me if you need further help.

Greetings,
Ivan Todorov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Chad
Top achievements
Rank 1
answered on 23 Aug 2011, 06:51 AM
i thought i did this already and no matter where i set the value to false, when the dialog displays,  it always is enabled ...  :(
0
Chad
Top achievements
Rank 1
answered on 23 Aug 2011, 06:52 AM
actually i dont know if i did it on the OnShown Event, let me try it again and get back to you ...

thank you !
0
Ivan Todorov
Telerik team
answered on 25 Aug 2011, 04:11 PM
Hi Chad,

Feel free to write back whenever you have any progress on the issue.

Best wishes,
Ivan Todorov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Chad
Top achievements
Rank 1
answered on 25 Aug 2011, 04:26 PM
this seems to have worked, thank you i was trying to do it on the LoadSettingsFromEvent method and it wasnt working !

thank you again Ivan
Tags
Scheduler and Reminder
Asked by
Chad
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Chad
Top achievements
Rank 1
Share this question
or