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

show Validate in Advances Form Edit message by server side

3 Answers 118 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Francesco
Top achievements
Rank 1
Francesco asked on 22 Mar 2011, 03:15 PM
hi, I have a simple Scheduler object. I would like make required the selection of resource in advances form edit for new appointment as the subject, can I do? I have found a trick to stop the execution server side using the  RadScheduler1_AppointmentInsert event, but not idea ho to show message.
Thanks

protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
       {
           //cerco l'agente selezionato
           Resource UserRes = e.Appointment.Resources.GetResourceByType("Agente");
           if (UserRes != null)
           {
              //DO BUSINESS
               Appointments.Add(new TrilanceScheduleBase(e.Appointment));
           }
           else
           {
               //STOP               
               
e.Cancel = true;
           }
       }


<telerik:RadScheduler runat="server" ID="RadScheduler1" 
                                        DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End"
                                        DayStartTime="07:00:00" DayEndTime="20:00:00" TimeZoneOffset="03:00:00" 
                                        OnAppointmentInsert="RadScheduler1_AppointmentInsert"
                                        OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" 
                                        OnAppointmentDelete="RadScheduler1_AppointmentDelete"                                        
                                        DataRecurrenceField="RecurrenceRule" 
                                        DataRecurrenceParentKeyField="RecurrenceParentId" Height="100%" 
                                        onappointmentdatabound="RadScheduler1_AppointmentDataBound" 
                                        ondatabound="RadScheduler1_DataBound" Culture="Italian (Italy)" 
                                         EditFormTimeFormat="HH.mm" FirstDayOfWeek="Monday" HoursPanelTimeFormat="HH" 
                                         SelectedView="WeekView" StartInsertingInAdvancedForm="True" 
                                         onformcreating="RadScheduler1_FormCreating">
                                         <DayView DayEndTime="20:00:00" DayStartTime="07:00:00" 
                                             WorkDayEndTime="20:00:00" WorkDayStartTime="07:00:00" />
                                         <AdvancedForm Modal="true" TimeFormat="HH.mm" />
                                         <TimelineView UserSelectable="false" />
                                         <WeekView DayEndTime="20:00:00" DayStartTime="07:00:00" 
                                             WorkDayEndTime="07:00:00" WorkDayStartTime="20:00:00" />
                                         <TimeSlotContextMenuSettings EnableDefault="true" />
                                         <AppointmentContextMenuSettings EnableDefault="true" />                                        
                                     </telerik:RadScheduler>

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 22 Mar 2011, 03:46 PM
Hi Francesco,

You can use the RegisterStartupScript function to display an alert with corresponding message:

ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('Please choose a resource!');", true);

Hope this helps.

Best wishes,
Veronica Milcheva
the Telerik team
0
Francesco
Top achievements
Rank 1
answered on 22 Mar 2011, 04:16 PM
thank to reply me. Show my picture. My question is if exist a method to call the validator/message in form to show a custom message. I have read in your documentation how to make a formadvance template but your interface is great and i don't won't to do by zero only for little customisation. I'm sure that there is a simple method. You exemple work but if the user show a message in form is bad show another in alert type.
thank a lot
0
Veronica
Telerik team
answered on 22 Mar 2011, 05:00 PM
Hello Francesco,

Yes, you are definitely right that a better way to show validation message is to keep it in the Advanced Form. However there is no easy way to do this without customizing the Advanced Form just to add a RequiredFieldValidator for the Resource. I know that it is not an easy approach and that's why I prepared a sample project for you.

Please take a look at the project in the attached .zip file and let me know if this was helpful.

Kind regards,
Veronica Milcheva
the Telerik team
Tags
Scheduler
Asked by
Francesco
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Francesco
Top achievements
Rank 1
Share this question
or