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

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

16 Answers 182 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Tanvi
Top achievements
Rank 1
Tanvi asked on 30 Nov 2010, 04:26 AM
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.

16 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 30 Nov 2010, 10:53 AM
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
0
Richard Slade
Top achievements
Rank 2
answered on 01 Dec 2010, 10:04 AM
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
0
Tanvi
Top achievements
Rank 1
answered on 02 Dec 2010, 03:34 PM
Hi
That function did help but could you tell me what parameters to be passed to the function in order to call it ?
0
Richard Slade
Top achievements
Rank 2
answered on 02 Dec 2010, 03:38 PM
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
0
Tanvi
Top achievements
Rank 1
answered on 02 Dec 2010, 04:39 PM
Hi

It worked !! Thank You so much.
0
Richard Slade
Top achievements
Rank 2
answered on 02 Dec 2010, 04:41 PM
Glad that worked. Please remember to mark all helpful posts as answer so others can find the solution too
Richard
0
Shruti
Top achievements
Rank 1
answered on 04 Dec 2010, 06:29 AM
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?
0
Richard Slade
Top achievements
Rank 2
answered on 04 Dec 2010, 09:35 AM
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
0
Shruti
Top achievements
Rank 1
answered on 04 Dec 2010, 08:18 PM
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.
0
Richard Slade
Top achievements
Rank 2
answered on 04 Dec 2010, 08:59 PM
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
0
Shruti
Top achievements
Rank 1
answered on 05 Dec 2010, 09:18 AM
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 ?
0
Richard Slade
Top achievements
Rank 2
answered on 05 Dec 2010, 01:44 PM
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
0
Tanvi
Top achievements
Rank 1
answered on 05 Dec 2010, 04:28 PM
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.
0
Richard Slade
Top achievements
Rank 2
answered on 05 Dec 2010, 05:28 PM

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
0
Michael
Top achievements
Rank 1
answered on 26 Apr 2013, 03:30 PM
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
0
Peter
Telerik team
answered on 01 May 2013, 01:55 PM
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.
Tags
Scheduler and Reminder
Asked by
Tanvi
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Tanvi
Top achievements
Rank 1
Shruti
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Peter
Telerik team
Share this question
or