Hide the recurrence button,location textbox & resource dropdown of Edit Appointment dialogu

17 posts, 0 answers
  1. Tanvi
    Tanvi avatar
    7 posts
    Member since:
    Nov 2010

    Posted 29 Nov 2010 Link to this post

    Hello,

    Can any one please tell me how to make the  recurrence button ,location textbox & resource dropdown visibility as false in the Edit Appointment dialog in c#.

    Thanks in advance.
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 30 Nov 2010 Link to this post

    Hello Tanvi,

    One way is to make your own edit appointment dialog. Have a look at this documentation link for more information.

    To simply hide the fields that you want to in the edit appointment dialog, please have a look at the following code:
    private void RadScheduler1_AppointmentEditDialogShowing(System.Object sender, Telerik.WinControls.UI.AppointmentEditDialogShowingEventArgs e)
    {
        EditAppointmentDialog dialog = (EditAppointmentDialog)e.AppointmentEditDialog;
      
        // recurrence button
        Control buttonRecurrence = dialog.Controls.Find("buttonRecurrence", true)[0];
        if (buttonRecurrence != null) {
            buttonRecurrence.Visible = false;
        }
      
        // Resource Drop down
        Control cmbResource = dialog.Controls.Find("cmbResource", true)[0];
        if (cmbResource != null) {
            cmbResource.Visible = false;
        }
      
        // Resource label
        Control labelResource = dialog.Controls.Find("labelResource", true)[0];
        if (labelResource != null) {
            labelResource.Visible = false;
        }
      
        // Location textbox
        Control txtLocation = dialog.Controls.Find("txtLocation", true)[0];
        if (txtLocation != null) {
            txtLocation.Visible = false;
        }
      
        // Location label
        Control labelLocation = dialog.Controls.Find("labelLocation", true)[0];
        if (labelLocation != null) {
            labelLocation.Visible = false;
        }
      
      
    }

    which was converted from the following VB.NET code
    Private Sub RadScheduler1_AppointmentEditDialogShowing(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.AppointmentEditDialogShowingEventArgs) Handles RadScheduler1.AppointmentEditDialogShowing
        Dim dialog As EditAppointmentDialog = CType(e.AppointmentEditDialog, EditAppointmentDialog)
        ' recurrence button
        Dim buttonRecurrence As Control = dialog.Controls.Find("buttonRecurrence", True)(0)
        If buttonRecurrence IsNot Nothing Then
            buttonRecurrence.Visible = False
        End If
        ' Resource Drop down
        Dim cmbResource As Control = dialog.Controls.Find("cmbResource", True)(0)
        If cmbResource IsNot Nothing Then
            cmbResource.Visible = False
        End If
        ' Resource label
        Dim labelResource As Control = dialog.Controls.Find("labelResource", True)(0)
        If labelResource IsNot Nothing Then
            labelResource.Visible = False
        End If
        ' Location textbox
        Dim txtLocation As Control = dialog.Controls.Find("txtLocation", True)(0)
        If txtLocation IsNot Nothing Then
            txtLocation.Visible = False
        End If
        ' Location label
        Dim labelLocation As Control = dialog.Controls.Find("labelLocation", True)(0)
        If labelLocation IsNot Nothing Then
            labelLocation.Visible = False
        End If
    End Sub

    hope this helps but let me know if you have any further questions
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 01 Dec 2010 Link to this post

    Hello,

    How did you get on with this? Please remember to mark as answer if it helped, or let me know if you need further help
    Richard
  5. Tanvi
    Tanvi avatar
    7 posts
    Member since:
    Nov 2010

    Posted 02 Dec 2010 Link to this post

    Hi
    That function did help but could you tell me what parameters to be passed to the function in order to call it ?
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Dec 2010 Link to this post

    Hello,

    This is just the event handler for the AppointmentEditDialogShowing event. Go to your designer, click on the grid and select properties. Click on the lightening bolt to bring up the events, and double click on the AppointmentEditDialogShowing section to create the event in code. You can then paste in the body of the above method

    Hope that helps.
    Richard
  7. Tanvi
    Tanvi avatar
    7 posts
    Member since:
    Nov 2010

    Posted 02 Dec 2010 Link to this post

    Hi

    It worked !! Thank You so much.
  8. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Dec 2010 Link to this post

    Glad that worked. Please remember to mark all helpful posts as answer so others can find the solution too
    Richard
  9. Shruti
    Shruti avatar
    11 posts
    Member since:
    Nov 2010

    Posted 04 Dec 2010 Link to this post

    Hi!!
           I want to save the values of subject,start time,end time,etc of the ApointmentEditDialog in the database at the click event of 'OK' button of the
           ApointmentEditDialog.

           In the same way i want to write my logic for deleting an appointment when a 'Delete' button of the ApointmentEditDialog is clicked

           Can you help me with this?
  10. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 04 Dec 2010 Link to this post

    Hello,

    In order to save your data to a database from the EditAppoinmentDialog you need to provide your own EditAppoinmentDialog and then override the ApplySettingsToEvent method and perform the datsabase update in there.

    Have a look at this link which describes how to do this

    Hope that helps but let me know if you have further questions
    Richard
  11. Shruti
    Shruti avatar
    11 posts
    Member since:
    Nov 2010

    Posted 04 Dec 2010 Link to this post

    hello,

    i was trying to use the following code to save the subject,starttime,etc from edit dialog to database.

      private void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
      {
            EditAppointmentDialog dialog = (EditAppointmentDialog)e.AppointmentEditDialog;

                Control buttonOK = dialog.Controls.Find("buttonOK", true)[0];
              
                if (buttonOK != null)
                {          
                     buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
                }
    }
      private void buttonOK_Click(object sender, EventArgs e)
            {
                 // logic to save in database    
            }
               

            for the 1st time when i am clicking on the radschedular , it pops up the EditAppointmentDialog and when i click on OK, it iterates through 
            buttonOK_Click method once.
            but, if i click on the radschedular again, it pops up the EditAppointmentDialog and when i click on OK, it iterates through buttonOK_Click   
            twice.. this goes on.
            I want my control to iterate through buttonOK_Click method only once.

           can you help me with this?
        
          Also, can you please tell how can i retrieve the properties of the cell in the radschedular? for eg, how can i retrieve the starttime and endtime 
         of appointment if a cell in the radschedular is clicked.
  12. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 04 Dec 2010 Link to this post

    Hello,

    The reason why you are getting the dialog pop up +1 times every time is because you are adding a new event handler every time you open the dialog. this only needs to be done once. Either that or you should remove the event handler once you have saved the details to the database.

    there are several ways to get the appointment details. For example, you could register for the AppointmentSelected event and then you have access to the appointment via the the evnt args.

    Hope that helps, but let me know if you need more information
    Richard
  13. Shruti
    Shruti avatar
    11 posts
    Member since:
    Nov 2010

    Posted 05 Dec 2010 Link to this post

    Thanks.. it worked..

    i have another doubt.

    I want to retrieve values of Subject textbox, StartDate,StartTime,EndDate,EndTime

    My code is:


           Control txtSubject;
            Control txtStartDate;
            Control txtEndDate;
            Control txtStartTime;
            Control txtEndTime;

       //Subject
                txtSubject = dialog.Controls.Find("txtSubject", true)[0];

                if (txtSubject != null)
                {
                }

                //Starttime
                txtStartDate = dialog.Controls.Find("dateStart", true)[0];

                if (txtStartTime != null)
                {
                }
                //Starttime
                txtStartTime = dialog.Controls.Find("TimeStart", true)[0];

                if (txtStartTime != null)
                {
                }

                txtEndDate = dialog.Controls.Find("DateEnd", true)[0];

                if (txtEndTime != null)
                {
                }

                //EndTime
                txtEndTime = dialog.Controls.Find("TimeEnd", true)[0];

                if (txtEndTime != null)
                {
                }

    I can retrieve what is typed in the Subject textbox using txtSubject.Text.
    but how can i retrieve value of StartDate,StartTime,EndDate,EndTime ?
  14. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Dec 2010 Link to this post

    Hello,

    You cannot do this from the AppointmentEditDialogShowing event handler. If you do, then getting the dateStart RadDateTimePicker control from the form will mean that you will get the value prior to the one that is currently being set. For exmaple, this...

    private void RadScheduler1_AppointmentEditDialogShowing(System.Object sender, Telerik.WinControls.UI.AppointmentEditDialogShowingEventArgs e)
    {
        EditAppointmentDialog dialog = (EditAppointmentDialog)e.AppointmentEditDialog;
        RadDateTimePicker dateTimePicker = (RadDateTimePicker)dialog.Controls.Find("dateStart", true)[0];
        if (dateTimePicker != null) {
            MessageBox.Show(dateTimePicker.Value.ToString());
        }
      
    }

    Will show you the datetime, but it will show you the date time before the date time has been set for the appointment that you are creating or editing. In other words, the date time and all the other controls have not yet been bound to the new or current appointment.

    As above, you will need to create your own appointment dialog box so you are able to capture the details required in the ApplySettingsTo event.

    Hope that helps
    Richard
  15. Tanvi
    Tanvi avatar
    7 posts
    Member since:
    Nov 2010

    Posted 05 Dec 2010 Link to this post

    Hi

    I want to retrieve start-time , end-time and date when an empty cell is clicked on radschedular. No appointment has been created yet.
    Eg: I click on empty cell in radschedular and I want to retrieve the corresponding start and end time along with the date of that cell.
  16. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 05 Dec 2010 Link to this post

    Tanvi,

    To get the date from a cell when you click on it, you need to subscribe to the Cellclick event.

    Private Sub RadScheduler1_CellClick(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.SchedulerCellEventArgs) Handles RadScheduler1.CellClick
        Console.WriteLine(e.Cell.Date.ToString())
    End Sub

    hope that helps. I's also ask you to go back and mark answers to your original question in this thread please.
    Thanks
    Richard
  17. Michael
    Michael avatar
    5 posts
    Member since:
    Mar 2013

    Posted 26 Apr 2013 Link to this post

    I still reading this. I was able to hide "labelStatus"

    ' Status label
            Dim labelStatus As Control = dialog.Controls.Find("labelStatus", True)(0)
            If labelStatus IsNot Nothing Then
                labelStatus.Visible = False
            End If

    How do I hide the status combobox?

    I try it:
    ' Status cmb
     
            Dim cmbStatus As Control = dialog.Controls.Find("cmbStatus", True)(0)
            If cmbStatus IsNot Nothing Then
                cmbStatus.Visible = False
            End If
     Thanks
  18. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 01 May 2013 Link to this post

    Hi Michael,

    Thank you for writing.

    I would like to clarify that there is not "cmbStatus" control in the AppointmentEditDialog". Maybe you mean "cmbResource"?

    Kind regards,
    Peter
    the Telerik team
    Get started with RadControls for WinForms with numerous videos and detailed documentation.
Back to Top
UI for WinForms is Visual Studio 2017 Ready