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

6 posts, 0 answers
  1. Chad
    Chad avatar
    11 posts
    Member since:
    Apr 2011

    Posted 20 Aug 2011 Link to this post

    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.
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 22 Aug 2011 Link to this post

    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 >>

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Chad
    Chad avatar
    11 posts
    Member since:
    Apr 2011

    Posted 23 Aug 2011 Link to this post

    i thought i did this already and no matter where i set the value to false, when the dialog displays,  it always is enabled ...  :(
  5. Chad
    Chad avatar
    11 posts
    Member since:
    Apr 2011

    Posted 23 Aug 2011 Link to this post

    actually i dont know if i did it on the OnShown Event, let me try it again and get back to you ...

    thank you !
  6. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 25 Aug 2011 Link to this post

    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 >>

  7. Chad
    Chad avatar
    11 posts
    Member since:
    Apr 2011

    Posted 25 Aug 2011 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready