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

[Solved] Validate Appointment from DataBase before Inserting and showing proper message, using AdvancedForm of RadSchedular

1 Answer 70 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 01 Jul 2009, 02:53 PM
In Advanced Insert form i have mentioned the code as below :


<scheduler:AdvancedForm runat="server" ID="AdvancedForm1"
Subject='<%# Bind("Subject") %>'
Start='<%# Bind("Start") %>'
End='<%# Bind("End") %>'
RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
UserID='<%# Bind("User") %>'
RoomID='<%# Bind("Room") %>'
Description='<%# Bind("Description") %>' />
<asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea">
<div class="rsAdvButtonWrapper">
<asp:LinkButton runat="server" ID="InsertButton" CssClass="rsAdvEditSave"
CommandName="Insert">
<span><%= Owner.Localization.Save %></span>
</asp:LinkButton>
<asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel"
CommandName="Cancel" CausesValidation="false">
<span><%= Owner.Localization.Cancel %></span>
</asp:LinkButton>
</div>
</asp:Panel>

And its saving the appointment but i want to validate the records from database before inserting 
its becoause i don;t want to add same record on same day so to validate this i want proper message to be display if 
record exsists for that day .
Do you know what it could be ? 

Thx..

Amit 

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 03 Jul 2009, 11:43 AM
Hello Amit,

Please, try handling AppointmentInsert like this:
protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)  
        {  
            foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(e.Appointment.Start.Date.Add(RadScheduler1.TimeZoneOffset), e.Appointment.Start.Date.AddDays(1).Add(RadScheduler1.TimeZoneOffset)))  
            {  
                if (e.Appointment.Subject == a.Subject)  
                {  
                    e.Cancel = true;  
                    Label1.Text = "Another appointment with the same subject already exists for this day";  
                }  
            }          
        } 


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
John
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or