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

Questions on Radscheduler

20 Answers 517 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Soumya
Top achievements
Rank 1
Soumya asked on 13 Aug 2012, 12:01 PM
I am going to use Radscheduler for the first time.Basically I need to customize my insert/edit window,do some programming in the code behind while inserting/updating(using sql datasource) an appointment.Also I need to have additional buttons and textbox controls in the insert/edit window.I have gone through all the demos and understood direct insert/update/delete from the markup using sql datasource.But for the server side programming,I am totally confused with the demos and tutorials .
I need to know if I can handle the scheduler also in the same manner as other telerik controls like radgrid and use the server side events as for a normal aspx page for the insert/edit form.

I need to do the insert/update in the code behind.Before inserting I need to calculate the appointment number,also need to fetch registration id from the another table.While insert in appointment table,I need to check if appointment exist  at that time of the day.If yes,need to show error message and save should not happen.

I am totally confused as how to do the save process in the code behind instead of using  <InsertParameters> / <UpdateParameters> in the markup and using below code in the code behind.
protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
{
  Appointments.Add(new AppointmentInfo(e.Appointment));
}
Can I do the above process in a buttonclick event where I can do all the calculations,insert/update the database
 and bind the scheduler?
Also,If I am customizing the popup window/Insert form,do I need to do as in 
http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx in order to have the recurrence 
reminder or should I use a raddock for the same ?

Please guide me on this asap.Sample code for the same if any,would be highly appreciable.
Thanks,
Soumya.

20 Answers, 1 is accepted

Sort by
0
Soumya
Top achievements
Rank 1
answered on 14 Aug 2012, 04:10 AM
Any answer?
0
Ivana
Telerik team
answered on 14 Aug 2012, 12:52 PM
Hi Soumya,

Attached is a project showing a case scenario of RadScheduler bound to various data sources using a template for its advanced form. You could take a look at it and use the example to achieve your own customization of the advanced form of RadScheduler.

I hope it will be helpful.

Kind regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 15 Aug 2012, 11:49 AM
Thanks Ivana for th answer.
Can I use the 'Scheduler/External Edit in Raddock' in link http://demos.telerik.com/aspnet-ajax/scheduler/examples/raddock/defaultcs.aspx  in my case?
Does it make any difference ?

Thanks,
Soumya
0
Ivana
Telerik team
answered on 15 Aug 2012, 12:40 PM
Hello Soumya,

It shouldn't make any difference -- it is just a different container for the elements/server controls needed for a detailed view of an appointment.

Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 16 Aug 2012, 11:03 AM
Hi ,
I am using 'Scheduler/External Edit in Raddock' in link http://demos.telerik.com/aspnet-ajax/scheduler/examples/raddock/defaultcs.aspx .While clicking on an appointment I am getting below error.
"Microsoft JScript runtime error: Unable to get value of the property 'indexOf': object is null or undefined".Please help me on this.

Please find below my markup and code behind(there is no major change from the demo):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using UnicareSystemDO.Registration;
using UnicareSystemDOService.Registration;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Collections;
using System.Drawing;
 
namespace UnicareSystemWeb.FramePages.Registration
{
    public partial class FrmScheduling : System.Web.UI.Page
    {
        bool CreatingExceptionAppointment
        {
            get { return (bool)ViewState["CreatingExceptionAppointment"]; }
            set { ViewState["CreatingExceptionAppointment"] = value; }
        }
 
        Appointment EditedAppointment
        {
            get
            {
                return (EditedAppointmentID != null) ? RadScheduler1.Appointments.FindByID(EditedAppointmentID) : null;
            }
            set
            {
                EditedAppointmentID = value.ID;
                EditedAppointmentParentID = value.RecurrenceParentID;
            }
        }
 
        Appointment EditedAppointmentParent
        {
            get
            {
                return (EditedAppointmentParentID != null) ? RadScheduler1.Appointments.FindByID(EditedAppointmentParentID) : null;
            }
        }
 
        private object EditedAppointmentID
        {
            get { return ViewState["EditedAppointmentID"]; }
            set { ViewState["EditedAppointmentID"] = value; }
        }
 
        private object EditedAppointmentParentID
        {
            get { return ViewState["EditedAppointmentParentID"]; }
            set { ViewState["EditedAppointmentParentID"] = value; }
        }
 
        protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
        {
            RadSchedulerRecurrenceEditor1.ResetLayout();
 
            if (e.Mode == SchedulerFormMode.Insert || e.Mode == SchedulerFormMode.Edit)
            {
                EditedAppointment = e.Appointment;
                e.Cancel = true;
            }
 
            var appointmentToEdit = RadScheduler1.PrepareToEdit(e.Appointment, RadScheduler1.EditingRecurringSeries);
 
            ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "Sys.Application.add_load(openForm);", true);
            PopulateEditForm(appointmentToEdit);
        }
 
        private bool IsAllDayAppointment(Appointment appointment)
        {
            DateTime displayStart = RadScheduler1.UtcToDisplay(appointment.Start);
            DateTime displayEnd = RadScheduler1.UtcToDisplay(appointment.End);
            return displayStart.CompareTo(displayStart.Date) == 0 && displayEnd.CompareTo(displayEnd.Date) == 0 && displayStart.CompareTo(displayEnd) != 0;
        }
 
        private DateTime Start
        {
            get
            {
                DateTime result = StartTime.SelectedDate.Value.Date;
 
                TimeSpan time = StartTime.SelectedDate.Value.TimeOfDay;
                result = result.Add(time);
 
                return RadScheduler1.DisplayToUtc(result);
            }
        }
 
        private DateTime End
        {
            get
            {
                DateTime result = EndTime.SelectedDate.Value.Date;
 
                TimeSpan time = EndTime.SelectedDate.Value.TimeOfDay;
                result = result.Add(time);
 
                return RadScheduler1.DisplayToUtc(result);
            }
        }
 
        private string RecurrenceRuleText
        {
            get
            {
                if (RadScheduler1.RecurrenceSupport)
                {
                    RadSchedulerRecurrenceEditor1.StartDate = Start;
                    RadSchedulerRecurrenceEditor1.EndDate = End;
 
                    RecurrenceRule rrule = RadSchedulerRecurrenceEditor1.RecurrenceRule;
 
                    if (rrule == null)
                    {
                        return string.Empty;
                    }
 
                    RecurrenceRule originalRule;
                    if (RecurrenceRule.TryParse(_originalRecurrenceRule.Value, out originalRule))
                    {
                        rrule.Exceptions = originalRule.Exceptions;
                    }
 
                    if (rrule.Range.RecursUntil != DateTime.MaxValue)
                    {
                        rrule.Range.RecursUntil = RadScheduler1.DisplayToUtc(rrule.Range.RecursUntil);
                    }
 
                    return rrule.ToString();
                }
 
                return string.Empty;
            }
            set
            {
                RecurrenceRule rrule = null;
 
                RecurrenceRule.TryParse(value, out rrule);
 
                if (rrule != null)
                {
                    if (rrule.Range.RecursUntil != DateTime.MaxValue)
                    {
                        DateTime recursUntil = RadScheduler1.UtcToDisplay(rrule.Range.RecursUntil);
 
                        if (!IsAllDayAppointment(EditedAppointment))
                        {
                            recursUntil = recursUntil.AddDays(-1);
                        }
 
                        rrule.Range.RecursUntil = recursUntil;
                    }
                }
                RadSchedulerRecurrenceEditor1.RecurrenceRuleText = (rrule != null) ? rrule.ToString() : value;
 
                _originalRecurrenceRule.Value = value;
            }
        }
 
        private void PopulateEditForm(Appointment editedAppointment)
        {
            Appointment appointmentToEdit = RadScheduler1.PrepareToEdit(editedAppointment, RadScheduler1.EditingRecurringSeries);
            DescriptionText.Text = appointmentToEdit.Subject;
 
            StartTime.SelectedDate = RadScheduler1.UtcToDisplay(appointmentToEdit.Start);
            EndTime.SelectedDate = RadScheduler1.UtcToDisplay(appointmentToEdit.End);
 
            if ((appointmentToEdit.Reminders.Count == 0) || (ReminderDropDown.SelectedValue == ""))
            {
                ReminderDropDown.SelectedValue = "";
            }
            else
            {
                ReminderDropDown.SelectedValue = appointmentToEdit.Reminders[0].Trigger.TotalMinutes.ToString();
            }
 
            Resource user = appointmentToEdit.Resources.GetResourceByType("Doctor");
            if (user != null)
            {
                UserDropDown.SelectedValue = user.Key.ToString();
            }
 
            RadSchedulerRecurrenceEditor1.StartDate = appointmentToEdit.Start;
            RadSchedulerRecurrenceEditor1.EndDate = appointmentToEdit.End;
 
            RecurrenceRuleText = appointmentToEdit.RecurrenceRule;
        }
 
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (EditedAppointment == null)
            {
                // Insert Appointment
                Appointment aptToInsert = PopulateBasicAppointmentPropertiesFromForm();
 
                RadScheduler1.InsertAppointment(aptToInsert);
            }
            else
            {
                if (!RadScheduler1.EditingRecurringSeries && (EditedAppointmentParent != null || EditedAppointment.RecurrenceState == RecurrenceState.Master))
                {
                    // Create Exception Appointment
                    var aptOccurence = EditedAppointment;
                    var aptException = PopulateBasicAppointmentPropertiesFromForm(
                                        RadScheduler1.PrepareToEdit(aptOccurence, RadScheduler1.EditingRecurringSeries)
                    );
 
                    RadScheduler1.UpdateAppointment(aptException);
                }
                else
                {
                    // Update Appointment
                    Appointment aptOriginal = EditedAppointment;
 
                    if (RadScheduler1.EditingRecurringSeries && (aptOriginal.RecurrenceState == RecurrenceState.Occurrence || aptOriginal.RecurrenceState == RecurrenceState.Exception))
                        aptOriginal = EditedAppointmentParent;
 
                    Appointment aptToUpdate = PopulateBasicAppointmentPropertiesFromForm(aptOriginal.Clone());
 
                    RadScheduler1.UpdateAppointment(aptToUpdate, aptOriginal);
                }
            }
 
            EditedAppointmentID = "";
            EditedAppointmentParentID = "";
 
            RadDock1.Closed = true;
        }
 
        private Appointment PopulateBasicAppointmentPropertiesFromForm()
        {
            return PopulateBasicAppointmentPropertiesFromForm(null);
        }
 
        private Appointment PopulateBasicAppointmentPropertiesFromForm(Appointment apt)
        {
            if (apt == null)
                apt = new Appointment();
 
            Resource user = new Resource("Doctor", int.Parse(UserDropDown.SelectedValue), UserDropDown.SelectedItem.Text);
            DateTime start = RadScheduler1.DisplayToUtc(StartTime.SelectedDate.Value);
            DateTime end = RadScheduler1.DisplayToUtc(EndTime.SelectedDate.Value);
            string reminder = ReminderDropDown.SelectedValue;
 
            apt.Subject = DescriptionText.Text;
            apt.Start = start;
            apt.End = end;
 
            apt.RecurrenceRule = RecurrenceRuleText;
 
            if (!String.IsNullOrEmpty(reminder))
            {
                apt.Reminders.Add(new Reminder(int.Parse(reminder)));
            }
 
            Resource existingUser = apt.Resources.GetResourceByType("Doctor");
            if (existingUser != null)
            {
                apt.Resources.Remove(existingUser);
            }
            apt.Resources.Add(user);
 
            return apt;
        }
    }
}

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FrmScheduling.aspx.cs"
    Inherits="FrmScheduling" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
        <script type="text/javascript">
 
            function openForm() {
                var dock = $find("<%= RadDock1.ClientID %>");
                // Center the RadDock on the screen
                var viewPort = $telerik.getViewPortSize();
                var xPos = Math.round((viewPort.width - parseInt(dock.get_width())) / 2);
                var yPos = Math.round((viewPort.height - parseInt(dock.get_height())) / 2);
                $telerik.setLocation(dock.get_element(), { x: xPos, y: yPos });
 
                dock.set_closed(false);
 
                var descriptionTextBox = $get('<%= DescriptionText.ClientID %>');
                descriptionTextBox.focus();
 
                Sys.Application.remove_load(openForm);
            }
 
            function hideForm() {
                var dock = $find("<%= RadDock1.ClientID %>");
                dock.set_closed(true);
 
                return true;
            }
 
            function dockMoved(sender, args) {
                //Return RadDock to his original HTML parent so it gets updated via ajax
                $get("<%= DockPanel.ClientID %>").appendChild(sender.get_element());
            }
 
        </script>
    </telerik:RadScriptBlock>
    <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel runat="server" ID="DockPanel">
                <telerik:RadDock runat="server" ID="RadDock1" Width="650px" Height="530px" Closed="true"
                     Title="Edit appointment" OnClientDockPositionChanged="dockMoved">
                    <Commands>
                        <telerik:DockCloseCommand />
                    </Commands>
                    <ContentTemplate>
                        <div class="editForm">
                            <div class="header">
                                <asp:Label runat="server" ID="StatusLabel"></asp:Label>
                            </div>
                            <div class="content">
                                Description:<br />
                                <asp:TextBox runat="server" ID="DescriptionText" Width="240px"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" ID="DescriptionTextRequiredFieldValidator"
                                    Display="Dynamic" ControlToValidate="DescriptionText" ErrorMessage="Description is required" />
                                <br />
                                <br />
                                Starts at:
                                <telerik:RadDateTimePicker ID="StartTime" runat="server" SharedCalendarID="SharedCalendar"
                                    SharedTimeViewID="SharedTimeView">
                                </telerik:RadDateTimePicker>
                                <asp:RequiredFieldValidator runat="server" ID="StartTimeRequiredFieldValidator" Display="Dynamic"
                                    ControlToValidate="StartTime" ErrorMessage="Start time is required" />
                                <br />
                                <br />
                                Ends at:
                                <telerik:RadDateTimePicker ID="EndTime" runat="server" SharedCalendarID="SharedCalendar"
                                    SharedTimeViewID="SharedTimeView">
                                </telerik:RadDateTimePicker>
                                <asp:RequiredFieldValidator runat="server" ID="EndTimeRequiredFieldValidator" Display="Dynamic"
                                    ControlToValidate="EndTime" ErrorMessage="End time is required" />
                                <br />
                                <br />
                                Doctor
                                <asp:DropDownList runat="server" ID="UserDropDown" DataSourceID="SqlDataSource2"
                                    DataTextField="doc_name" DataValueField="doc_id">
                                </asp:DropDownList>
                                <br />
                                <br />
                                <asp:Label runat="server" Text="Reminder" ID="lblReminders"></asp:Label>
                                <telerik:RadComboBox runat="server" ID="ReminderDropDown" Width="120px">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="None" Value="" />
                                        <telerik:RadComboBoxItem Text="0 minutes" Value="0" />
                                        <telerik:RadComboBoxItem Text="1 minute" Value="5" />
                                        <telerik:RadComboBoxItem Text="2 minutes" Value="10" />
                                        <telerik:RadComboBoxItem Text="3 minutes" Value="15" />
                                        <telerik:RadComboBoxItem Text="4 minutes" Value="30" />
                                        <telerik:RadComboBoxItem Text="1 hour" Value="60" />
                                        <telerik:RadComboBoxItem Text="2 hours" Value="120" />
                                        <telerik:RadComboBoxItem Text="3 hours" Value="180" />
                                        <telerik:RadComboBoxItem Text="4 hours" Value="240" />
                                        <telerik:RadComboBoxItem Text="5 hours" Value="300" />
                                        <telerik:RadComboBoxItem Text="6 hours" Value="360" />
                                        <telerik:RadComboBoxItem Text="7 hours" Value="420" />
                                        <telerik:RadComboBoxItem Text="8 hours" Value="480" />
                                        <telerik:RadComboBoxItem Text="9 hours" Value="540" />
                                        <telerik:RadComboBoxItem Text="10 hours" Value="600" />
                                        <telerik:RadComboBoxItem Text="11 hours" Value="660" />
                                        <telerik:RadComboBoxItem Text="12 hours" Value="720" />
                                        <telerik:RadComboBoxItem Text="18 hours" Value="1080" />
                                        <telerik:RadComboBoxItem Text="1 day" Value="1440" />
                                        <telerik:RadComboBoxItem Text="2 days" Value="2880" />
                                        <telerik:RadComboBoxItem Text="3 days" Value="4320" />
                                        <telerik:RadComboBoxItem Text="4 days" Value="5760" />
                                        <telerik:RadComboBoxItem Text="1 week" Value="10080" />
                                        <telerik:RadComboBoxItem Text="2 weeks" Value="20160" />
                                    </Items>
                                </telerik:RadComboBox>
                            </div>
                            <div class="footer">
                                <asp:Button runat="server" ID="SubmitButton" Text="Update" OnClick="SubmitButton_Click" />
                                <button onclick="hideForm();" type="button" style="margin-right: 20px;">
                                    Cancel</button>
                            </div>
                            <telerik:RadTimeView ID="SharedTimeView" runat="server">
                            </telerik:RadTimeView>
                            <telerik:RadCalendar ID="SharedCalendar" runat="server" EnableMonthYearFastNavigation="False"
                                EnableMultiSelect="False" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False">
                            </telerik:RadCalendar>
                            <asp:HiddenField runat="server" ID="_originalRecurrenceRule" />
                            <telerik:RadSchedulerRecurrenceEditor runat="server" ID="RadSchedulerRecurrenceEditor1" />
                        </div>
                    </ContentTemplate>
                </telerik:RadDock>
            </asp:Panel>
            <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" TimeZoneOffset="03:00:00"
                SelectedDate="2012-04-16" DayStartTime="08:00:00" DayEndTime="18:00:00" StartEditingInAdvancedForm="false"
                SelectedView="DayView" DataKeyField="Fld_AppId" DataSubjectField="Subject" DataStartField="Fld_AppFtime"
                DataEndField="Fld_AppTtime" DataReminderField="Reminder" DataRecurrenceField="RecurrenceRule"
                DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="SqlDataSource1"
                OnFormCreating="RadScheduler1_FormCreating" Reminders-Enabled="true" OverflowBehavior="Scroll">
                <AdvancedForm Modal="true" />
                <ResourceTypes>
                    <telerik:ResourceType KeyField="RoomID" Name="Room" TextField="RoomName" ForeignKeyField="Fld_RoomID"
                        DataSourceID="RoomsDataSource" />
                    <telerik:ResourceType KeyField="doc_id" Name="Doctor" TextField="doc_name" ForeignKeyField="MdiSft_Emp_ID"
                        DataSourceID="SqlDataSource2" />
                </ResourceTypes>
                <TimeSlotContextMenuSettings EnableDefault="true" />
                <AppointmentContextMenuSettings EnableDefault="true" />
            </telerik:RadScheduler>
        </ContentTemplate>
    </asp:UpdatePanel>
     
     <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SystemConnection %>"
        SelectCommand="SELECT * FROM [doctor_master]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SystemConnection %>"        
        SelectCommand="SELECT * FROM [Tbl_FixSchedule]" >
    </asp:SqlDataSource>   
    <asp:SqlDataSource id="RoomsDataSource" runat="server"   ConnectionString="<%$ ConnectionStrings:SystemConnection %>"
        selectcommand="SELECT * FROM [Tbl_ExamRooms]">
    </asp:SqlDataSource>   
   
    </form>
</body>
</html>
0
Soumya
Top achievements
Rank 1
answered on 17 Aug 2012, 06:51 AM
Any answers please.
0
Soumya
Top achievements
Rank 1
answered on 17 Aug 2012, 12:06 PM
Telerik team ,
could you please look into this.It is very urgent.
Thanks,
Soumya
0
Helen
Telerik team
answered on 17 Aug 2012, 04:55 PM
Hi Soumya,

We tried to reproduce the problem locally, but without much success. Please find attached our test project(you have to add the "Telerik.mdf" file provided in the installation to the App_Data folder in order to successfully run it).
Could you please modify it so we can see the problem locally?

We always appreciate when a runnable sample is provided.This way we can find a precise solution much faster 

We also noticed that your support has expired on 10 August, but the thread was opened after that. Please renew your license if you need further assistance.

Greetings,
Helen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 18 Aug 2012, 07:01 AM
Hi Helen,
Please find the modified project .I am still facing the issue.I am using sql datasource.I have replaced session datasource with sql datasource and gave my keyfield and start and end variable in the radscheduler in markup.In the code behind,only user name is changed.Rest everything is the same.
I am still getting the javascript error as "Microsoft JScript runtime error: Unable to get value of the property 'indexOf': object is null or undefined".This error comes  on clicking a timeslot in the scheduler.I am not able to attach the screenshot here.Internet explorer 9 is my browser window.

Also I have changed the below line of code in aspx.cs 

ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "Sys.Application.add_load(openForm);", true); as

ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "openForm();", true);
Then in the markup, RadDock1.ClientID is null in javascript function openform().This does not show any error in Firefox,but raddock popup is not coming up.
In Internet explorer 9,this shows an error as RadDock1.ClientID is null.

Could you please let me know where I am going wrong.Is it because of the browser or any other issue.Please help me on this.I am stuck with this issue for many days.
aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="raddock.aspx.cs" Inherits="UnicareSystemWeb.FramePages.Registration.raddock" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
        <script type="text/javascript">
 
            function openForm() {
                var dock = $find("<%= RadDock1.ClientID %>");
                // Center the RadDock on the screen
                var viewPort = $telerik.getViewPortSize();
                var xPos = Math.round((viewPort.width - parseInt(dock.get_width())) / 2);
                var yPos = Math.round((viewPort.height - parseInt(dock.get_height())) / 2);
                $telerik.setLocation(dock.get_element(), { x: xPos, y: yPos });
 
                dock.set_closed(false);
 
                var descriptionTextBox = $get('<%= DescriptionText.ClientID %>');
                descriptionTextBox.focus();
 
                Sys.Application.remove_load(openForm);
            }
 
            function hideForm() {
                var dock = $find("<%= RadDock1.ClientID %>");
                dock.set_closed(true);
 
                return true;
            }
 
            function dockMoved(sender, args) {
                //Return RadDock to his original HTML parent so it gets updated via ajax
                $get("<%= DockPanel.ClientID %>").appendChild(sender.get_element());
            }
  
        </script>
    </telerik:RadScriptBlock>
    <asp:updatepanel runat="server" id="UpdatePanel1" updatemode="Conditional">
        <contenttemplate>
            <asp:Panel runat="server" ID="DockPanel">
                <telerik:RadDock runat="server" ID="RadDock1" Width="650px" Height="530px" Closed="true"
                     Title="Edit appointment" OnClientDockPositionChanged="dockMoved" Style="z-index:5000">
                    <Commands>
                        <telerik:DockCloseCommand />
                    </Commands>
                    <ContentTemplate>
                        <div class="editForm">
                            <div class="header">
                                <asp:Label runat="server" ID="StatusLabel"></asp:Label>
                            </div>
                            <div class="content">
                                Description:<br />
                                <asp:TextBox runat="server" ID="DescriptionText" Width="240px"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" ID="DescriptionTextRequiredFieldValidator"
                                    Display="Dynamic" ControlToValidate="DescriptionText" ErrorMessage="Description is required" />
                                <br />
                                <br />
                                Starts at:
                                <telerik:RadDateTimePicker ID="StartTime" runat="server" SharedCalendarID="SharedCalendar"
                                    SharedTimeViewID="SharedTimeView">
                                </telerik:RadDateTimePicker>
                                <asp:RequiredFieldValidator runat="server" ID="StartTimeRequiredFieldValidator" Display="Dynamic"
                                    ControlToValidate="StartTime" ErrorMessage="Start time is required" />
                                <br />
                                <br />
                                Ends at:
                                <telerik:RadDateTimePicker ID="EndTime" runat="server" SharedCalendarID="SharedCalendar"
                                    SharedTimeViewID="SharedTimeView">
                                </telerik:RadDateTimePicker>
                                <asp:RequiredFieldValidator runat="server" ID="EndTimeRequiredFieldValidator" Display="Dynamic"
                                    ControlToValidate="EndTime" ErrorMessage="End time is required" />
                                <br />
                                <br />
                                Doctor
                                <asp:DropDownList runat="server" ID="UserDropDown" DataSourceID="UsersDataSource"
                                    DataTextField="doc_name" DataValueField="doc_id">
                                </asp:DropDownList>
                                <br />
                                <br />
                                <asp:Label runat="server" Text="Reminder" ID="lblReminders"></asp:Label>
                                <telerik:RadComboBox runat="server" ID="ReminderDropDown" Width="120px">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="None" Value="" />
                                        <telerik:RadComboBoxItem Text="0 minutes" Value="0" />
                                        <telerik:RadComboBoxItem Text="1 minute" Value="5" />
                                        <telerik:RadComboBoxItem Text="2 minutes" Value="10" />
                                        <telerik:RadComboBoxItem Text="3 minutes" Value="15" />
                                        <telerik:RadComboBoxItem Text="4 minutes" Value="30" />
                                        <telerik:RadComboBoxItem Text="1 hour" Value="60" />
                                        <telerik:RadComboBoxItem Text="2 hours" Value="120" />
                                        <telerik:RadComboBoxItem Text="3 hours" Value="180" />
                                        <telerik:RadComboBoxItem Text="4 hours" Value="240" />
                                        <telerik:RadComboBoxItem Text="5 hours" Value="300" />
                                        <telerik:RadComboBoxItem Text="6 hours" Value="360" />
                                        <telerik:RadComboBoxItem Text="7 hours" Value="420" />
                                        <telerik:RadComboBoxItem Text="8 hours" Value="480" />
                                        <telerik:RadComboBoxItem Text="9 hours" Value="540" />
                                        <telerik:RadComboBoxItem Text="10 hours" Value="600" />
                                        <telerik:RadComboBoxItem Text="11 hours" Value="660" />
                                        <telerik:RadComboBoxItem Text="12 hours" Value="720" />
                                        <telerik:RadComboBoxItem Text="18 hours" Value="1080" />
                                        <telerik:RadComboBoxItem Text="1 day" Value="1440" />
                                        <telerik:RadComboBoxItem Text="2 days" Value="2880" />
                                        <telerik:RadComboBoxItem Text="3 days" Value="4320" />
                                        <telerik:RadComboBoxItem Text="4 days" Value="5760" />
                                        <telerik:RadComboBoxItem Text="1 week" Value="10080" />
                                        <telerik:RadComboBoxItem Text="2 weeks" Value="20160" />
                                    </Items>
                                </telerik:RadComboBox>
                            </div>
                            <div class="footer">
                                <asp:Button runat="server" ID="SubmitButton" Text="Update" OnClick="SubmitButton_Click" />
                                <button onclick="hideForm();" type="button" style="margin-right: 20px;">
                                    Cancel</button>
                            </div>
                            <telerik:RadTimeView ID="SharedTimeView" runat="server">
                            </telerik:RadTimeView>
                            <telerik:RadCalendar ID="SharedCalendar" runat="server" EnableMonthYearFastNavigation="False"
                                EnableMultiSelect="False" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False">
                            </telerik:RadCalendar>
                            <asp:HiddenField runat="server" ID="_originalRecurrenceRule" />
                            <telerik:RadSchedulerRecurrenceEditor runat="server" ID="RadSchedulerRecurrenceEditor1" />
                        </div>
                    </ContentTemplate>
                </telerik:RadDock>
            </asp:Panel>
            <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" TimeZoneOffset="03:00:00"
                SelectedDate="2012-04-16" DayStartTime="08:00:00" DayEndTime="18:00:00" StartEditingInAdvancedForm="false"
                SelectedView="DayView" DataKeyField="Fld_AppId" DataSubjectField="Subject" DataStartField="Fld_AppFtime"
                DataEndField="Fld_AppTtime" DataReminderField="Reminder" DataRecurrenceField="RecurrenceRule"
                DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="AppointmentsDataSource"
                OnFormCreating="RadScheduler1_FormCreating" Reminders-Enabled="true" OverflowBehavior="Scroll" StartInsertingInAdvancedForm="false">
                <AdvancedForm Modal="true" />
                <ResourceTypes>
                    <%--<telerik:ResourceType KeyField="ID" Name="Room" TextField="RoomName" ForeignKeyField="RoomID"
                        DataSourceID="RoomsDataSource" />--%>
                    <telerik:ResourceType KeyField="doc_id" Name="Doctor" TextField="doc_name" ForeignKeyField="MdiSft_Emp_ID"
                        DataSourceID="UsersDataSource" />
                </ResourceTypes>
                <TimeSlotContextMenuSettings EnableDefault="true" />
                <AppointmentContextMenuSettings EnableDefault="true" />
            </telerik:RadScheduler>
        </contenttemplate>
    </asp:updatepanel>
    <asp:SqlDataSource ID="UsersDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SystemConnection %>"
        SelectCommand="SELECT * FROM [doctor_master]" >  </asp:SqlDataSource>          
        
    <asp:SqlDataSource ID="AppointmentsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SystemConnection %>"        
        SelectCommand="SELECT * FROM [Tbl_FixSchedule]" ></asp:SqlDataSource>
         <%--InsertCommand="INSERT INTO [Tbl_FixSchedule] ([Subject], [Fld_AppFtime], [Fld_AppTtime], [MdiSft_Emp_ID], [RecurrenceRule], [RecurrenceParentID], [Reminder]) VALUES (@Subject, @Fld_AppFtime, @Fld_AppTtime, @UserID, @RecurrenceRule, @RecurrenceParentID,  @Reminder)"
        UpdateCommand="UPDATE [Tbl_FixSchedule] SET [Subject] = @Subject, [Fld_AppFtime] = @Fld_AppFtime, [Fld_AppTtime] = @Fld_AppTtime, [MdiSft_Emp_ID] = @MdiSft_Emp_ID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Reminder] = @ReminderWHERE [Fld_AppId] = @IFld_AppId"
        DeleteCommand="DELETE FROM [Tbl_FixSchedule] WHERE [Fld_AppId] = @Fld_AppId"
        >
        <DeleteParameters>
            <asp:parameter name="Fld_AppId" type="Int64" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:parameter name="Subject" type="String" />
            <asp:parameter name="Fld_AppFtime" type="DateTime" />
            <asp:parameter name="Fld_AppTtime" type="DateTime" />
            <asp:parameter name="MdiSft_Emp_ID" type="Int64" />        
            <asp:parameter name="RecurrenceRule" type="String" />
            <asp:parameter name="RecurrenceParentID" type="Int16" />           
            <asp:parameter name="Fld_AppId" type="Int64" />
        </UpdateParameters>
        <InsertParameters>
            <asp:parameter name="Subject" type="String" />
            <asp:parameter name="Fld_AppFtime" type="DateTime" />
            <asp:parameter name="Fld_AppTtime" type="DateTime" />
            <asp:parameter name="MdiSft_Emp_ID" type="Int64" />        
            <asp:parameter name="RecurrenceRule" type="String" />
            <asp:parameter name="RecurrenceParentID" type="Int16" />           
            <asp:parameter name="Reminder" type="String" />        
        </InsertParameters>--%>
      <%-- </asp:SqlDataSource> --%>
    <%--<sds:SessionDataSource ID="AppointmentsDataSource" runat="server" PrimaryKeyFields="ID"
        ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT * FROM [Appointments]"
        InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [UserID], [RoomID], [RecurrenceRule], [RecurrenceParentID], [Annotations], [Description], [Reminder], [LastModified]) VALUES (@Subject, @Start, @End, @UserID, @RoomID, @RecurrenceRule, @RecurrenceParentID, @Annotations, @Description, @Reminder, @LastModified)"
        UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [UserID] = @UserID, [RoomID] = @RoomID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Annotations] = @Annotations, [Description] = @Description, [Reminder] = @Reminder, [LastModified] = @LastModified WHERE [ID] = @ID"
        DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID" ClearSessionOnInitialLoad="True"
        SessionKey="System.Web.UI.Page_AppointmentsDataSource">
        <DeleteParameters>
            <asp:parameter name="ID" type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:parameter name="Subject" type="String" />
            <asp:parameter name="Start" type="DateTime" />
            <asp:parameter name="End" type="DateTime" />
            <asp:parameter name="UserID" type="Int32" />
            <asp:parameter name="RoomID" type="Int32" />
            <asp:parameter name="RecurrenceRule" type="String" />
            <asp:parameter name="RecurrenceParentID" type="Int32" />
            <asp:parameter name="Annotations" type="String" />
            <asp:parameter name="Description" type="String" />
            <asp:parameter name="Reminder" type="String" />
            <asp:parameter name="LastModified" type="String" />
            <asp:parameter name="ID" type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:parameter name="Subject" type="String" />
            <asp:parameter name="Start" type="DateTime" />
            <asp:parameter name="End" type="DateTime" />
            <asp:parameter name="UserID" type="Int32" />
            <asp:parameter name="RoomID" type="Int32" />
            <asp:parameter name="RecurrenceRule" type="String" />
            <asp:parameter name="RecurrenceParentID" type="Int32" />
            <asp:parameter name="Annotations" type="String" />
            <asp:parameter name="Description" type="String" />
            <asp:parameter name="Reminder" type="String" />
            <asp:parameter name="LastModified" type="String" />
        </InsertParameters>
    </sds:SessionDataSource>
    <sds:SessionDataSource ID="RoomsDataSource" runat="server" DisplayWarning="false"
        ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT * FROM [Rooms]">
    </sds:SessionDataSource>
    <sds:SessionDataSource ID="UsersDataSource" runat="server" DisplayWarning="false"
        ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT * FROM [Users]">
    </sds:SessionDataSource>--%>
    </form>
</body>
</html>

apx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Collections;
using System.Drawing;
 
namespace UnicareSystemWeb.FramePages.Registration
{
    public partial class raddock : System.Web.UI.Page
    {
        
        bool CreatingExceptionAppointment
        {
            get { return (bool)ViewState["CreatingExceptionAppointment"]; }
            set { ViewState["CreatingExceptionAppointment"] = value; }
        }
 
        Appointment EditedAppointment
        {
            get
            {
                return (EditedAppointmentID != null) ? RadScheduler1.Appointments.FindByID(EditedAppointmentID) : null;
            }
            set
            {
                EditedAppointmentID = value.ID;
                EditedAppointmentParentID = value.RecurrenceParentID;
            }
        }
 
        Appointment EditedAppointmentParent
        {
            get
            {
                return (EditedAppointmentParentID != null) ? RadScheduler1.Appointments.FindByID(EditedAppointmentParentID) : null;
            }
        }
 
        private object EditedAppointmentID
        {
            get { return ViewState["EditedAppointmentID"]; }
            set { ViewState["EditedAppointmentID"] = value; }
        }
 
        private object EditedAppointmentParentID
        {
            get { return ViewState["EditedAppointmentParentID"]; }
            set { ViewState["EditedAppointmentParentID"] = value; }
        }
 
        protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
        {
            RadSchedulerRecurrenceEditor1.ResetLayout();
 
            if (e.Mode == SchedulerFormMode.Insert || e.Mode == SchedulerFormMode.Edit)
            {
                EditedAppointment = e.Appointment;
                e.Cancel = true;
            }
 
            var appointmentToEdit = RadScheduler1.PrepareToEdit(e.Appointment, RadScheduler1.EditingRecurringSeries);
 
            ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "Sys.Application.add_load(openForm);", true);
            PopulateEditForm(appointmentToEdit);
        }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
 
        }
 
        private DateTime Start
        {
            get
            {
                DateTime result = StartTime.SelectedDate.Value.Date;
 
                TimeSpan time = StartTime.SelectedDate.Value.TimeOfDay;
                result = result.Add(time);
 
                return RadScheduler1.DisplayToUtc(result);
            }
        }
 
        private DateTime End
        {
            get
            {
                DateTime result = EndTime.SelectedDate.Value.Date;
 
                TimeSpan time = EndTime.SelectedDate.Value.TimeOfDay;
                result = result.Add(time);
 
                return RadScheduler1.DisplayToUtc(result);
            }
        }
 
        private string RecurrenceRuleText
        {
            get
            {
                if (RadScheduler1.RecurrenceSupport)
                {
                    RadSchedulerRecurrenceEditor1.StartDate = Start;
                    RadSchedulerRecurrenceEditor1.EndDate = End;
 
                    RecurrenceRule rrule = RadSchedulerRecurrenceEditor1.RecurrenceRule;
 
                    if (rrule == null)
                    {
                        return string.Empty;
                    }
 
                    RecurrenceRule originalRule;
                    if (RecurrenceRule.TryParse(_originalRecurrenceRule.Value, out originalRule))
                    {
                        rrule.Exceptions = originalRule.Exceptions;
                    }
 
                    if (rrule.Range.RecursUntil != DateTime.MaxValue)
                    {
                        rrule.Range.RecursUntil = RadScheduler1.DisplayToUtc(rrule.Range.RecursUntil);
                    }
 
                    return rrule.ToString();
                }
 
                return string.Empty;
            }
            set
            {
                RecurrenceRule rrule = null;
 
                RecurrenceRule.TryParse(value, out rrule);
 
                if (rrule != null)
                {
                    if (rrule.Range.RecursUntil != DateTime.MaxValue)
                    {
                        DateTime recursUntil = RadScheduler1.UtcToDisplay(rrule.Range.RecursUntil);
 
                        if (!IsAllDayAppointment(EditedAppointment))
                        {
                            recursUntil = recursUntil.AddDays(-1);
                        }
 
                        rrule.Range.RecursUntil = recursUntil;
                    }
                }
                RadSchedulerRecurrenceEditor1.RecurrenceRuleText = (rrule != null) ? rrule.ToString() : value;
 
                _originalRecurrenceRule.Value = value;
            }
        }
 
        private void PopulateEditForm(Appointment editedAppointment)
        {
            Appointment appointmentToEdit = RadScheduler1.PrepareToEdit(editedAppointment, RadScheduler1.EditingRecurringSeries);
            DescriptionText.Text = appointmentToEdit.Subject;
 
            StartTime.SelectedDate = RadScheduler1.UtcToDisplay(appointmentToEdit.Start);
            EndTime.SelectedDate = RadScheduler1.UtcToDisplay(appointmentToEdit.End);
 
            if ((appointmentToEdit.Reminders.Count == 0) || (ReminderDropDown.SelectedValue == ""))
            {
                ReminderDropDown.SelectedValue = "";
            }
            else
            {
                ReminderDropDown.SelectedValue = appointmentToEdit.Reminders[0].Trigger.TotalMinutes.ToString();
            }
 
            Resource user = appointmentToEdit.Resources.GetResourceByType("Doctor");
            if (user != null)
            {
                UserDropDown.SelectedValue = user.Key.ToString();
            }
 
            RadSchedulerRecurrenceEditor1.StartDate = appointmentToEdit.Start;
            RadSchedulerRecurrenceEditor1.EndDate = appointmentToEdit.End;
 
            RecurrenceRuleText = appointmentToEdit.RecurrenceRule;
        }
 
        private Appointment PopulateBasicAppointmentPropertiesFromForm()
        {
            return PopulateBasicAppointmentPropertiesFromForm(null);
        }
 
        private Appointment PopulateBasicAppointmentPropertiesFromForm(Appointment apt)
        {
            if (apt == null)
                apt = new Appointment();
 
            Resource user = new Resource("Doctor", int.Parse(UserDropDown.SelectedValue), UserDropDown.SelectedItem.Text);
            DateTime start = RadScheduler1.DisplayToUtc(StartTime.SelectedDate.Value);
            DateTime end = RadScheduler1.DisplayToUtc(EndTime.SelectedDate.Value);
            string reminder = ReminderDropDown.SelectedValue;
 
            apt.Subject = DescriptionText.Text;
            apt.Start = start;
            apt.End = end;
             
 
            apt.RecurrenceRule = RecurrenceRuleText;
 
            if (!String.IsNullOrEmpty(reminder))
            {
                apt.Reminders.Add(new Reminder(int.Parse(reminder)));
            }
 
            Resource existingUser = apt.Resources.GetResourceByType("Doctor");
            if (existingUser != null)
            {
                apt.Resources.Remove(existingUser);
            }
            apt.Resources.Add(user);
 
            return apt;
        }
 
        private bool IsAllDayAppointment(Appointment appointment)
        {
            DateTime displayStart = RadScheduler1.UtcToDisplay(appointment.Start);
            DateTime displayEnd = RadScheduler1.UtcToDisplay(appointment.End);
            return displayStart.CompareTo(displayStart.Date) == 0 && displayEnd.CompareTo(displayEnd.Date) == 0 && displayStart.CompareTo(displayEnd) != 0;
        }
    }
}
0
Soumya
Top achievements
Rank 1
answered on 20 Aug 2012, 06:52 AM
Any answers ?\it is very urgent.
Please help me on this

Thanks,
Soumya
0
Helen
Telerik team
answered on 20 Aug 2012, 01:21 PM
Hello Soumya,

Please use the following condition to execute the script:

if (!ClientScript.IsStartupScriptRegistered("formScript"))
{
    ClientScript.RegisterStartupScript(this.GetType(), "formScript", "openForm();", true);
}


Kind regards,
Helen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 20 Aug 2012, 02:00 PM
Hi Helen,
That didn't work.
Again I am getting the same error.Please find attached the screenshot.
As I mentioned earlier,the code doesn't show any error in firefox in this case also ,but the raddock is not poping up.But in internet explorer 9,I am getting the errror "Microsoft JScript runtime error: Unable to get value of the property 'indexOf': object is null or undefined"

Please look into this.

Thanks,
Soumya
0
Helen
Telerik team
answered on 20 Aug 2012, 03:37 PM
Hi Soumya,

Please find attached our test project. Does it work at your side?


Greetings,
Helen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 20 Aug 2012, 04:43 PM
Hi Helen,
Thanks for the quick reply.
The sample includes session datasource and do you need me to run the sample with session datasource with TelerikConnectionString?
If so how should be the connection string in web config file?Correct me if my understanding is not correct.Please let me know how should I run the project with the session datasource in the attached sample project.

Again I have ran the sample project u have given with my sql datasource and its fields as given below.But I am getting the same error.Please find attached my appointment database design.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="teleriksample.aspx.cs" Inherits="SystemWeb.FramePages.Registration.teleriksample" %>
 
 
<%--<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
 <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <asp:updatepanel runat="server" id="UpdatePanel1" updatemode="Conditional">
        <contenttemplate>
            <asp:Panel runat="server" ID="DockPanel">
                <telerik:RadDock runat="server" ID="RadDock1" Width="650px" Height="530px" Closed="true"
                     Title="Edit appointment" OnClientDockPositionChanged="dockMoved" Style="z-index:5000">
                    <Commands>
                        <telerik:DockCloseCommand />
                    </Commands>
                    <ContentTemplate>
                        <div class="editForm">
                            <div class="header">
                                <asp:Label runat="server" ID="StatusLabel"></asp:Label>
                            </div>
                            <div class="content">
                                Description:<br />
                                <asp:TextBox runat="server" ID="DescriptionText" Width="240px"></asp:TextBox>
                                <asp:RequiredFieldValidator runat="server" ID="DescriptionTextRequiredFieldValidator"
                                    Display="Dynamic" ControlToValidate="DescriptionText" ErrorMessage="Description is required" />
                                <br />
                                <br />
                                Starts at:
                                <telerik:RadDateTimePicker ID="StartTime" runat="server" SharedCalendarID="SharedCalendar"
                                    SharedTimeViewID="SharedTimeView">
                                </telerik:RadDateTimePicker>
                                <asp:RequiredFieldValidator runat="server" ID="StartTimeRequiredFieldValidator" Display="Dynamic"
                                    ControlToValidate="StartTime" ErrorMessage="Start time is required" />
                                <br />
                                <br />
                                Ends at:
                                <telerik:RadDateTimePicker ID="EndTime" runat="server" SharedCalendarID="SharedCalendar"
                                    SharedTimeViewID="SharedTimeView">
                                </telerik:RadDateTimePicker>
                                <asp:RequiredFieldValidator runat="server" ID="EndTimeRequiredFieldValidator" Display="Dynamic"
                                    ControlToValidate="EndTime" ErrorMessage="End time is required" />
                                <br />
                                <br />
                                Doctor
                                <asp:DropDownList runat="server" ID="UserDropDown" DataSourceID="UsersDataSource"
                                    DataTextField="doc_name" DataValueField="doc_id">
                                </asp:DropDownList>
                                <br />
                                <br />
                                <asp:Label runat="server" Text="Reminder" ID="lblReminders"></asp:Label>
                                <telerik:RadComboBox runat="server" ID="ReminderDropDown" Width="120px">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="None" Value="" />
                                        <telerik:RadComboBoxItem Text="0 minutes" Value="0" />
                                        <telerik:RadComboBoxItem Text="1 minute" Value="5" />
                                        <telerik:RadComboBoxItem Text="2 minutes" Value="10" />
                                        <telerik:RadComboBoxItem Text="3 minutes" Value="15" />
                                        <telerik:RadComboBoxItem Text="4 minutes" Value="30" />
                                        <telerik:RadComboBoxItem Text="1 hour" Value="60" />
                                        <telerik:RadComboBoxItem Text="2 hours" Value="120" />
                                        <telerik:RadComboBoxItem Text="3 hours" Value="180" />
                                        <telerik:RadComboBoxItem Text="4 hours" Value="240" />
                                        <telerik:RadComboBoxItem Text="5 hours" Value="300" />
                                        <telerik:RadComboBoxItem Text="6 hours" Value="360" />
                                        <telerik:RadComboBoxItem Text="7 hours" Value="420" />
                                        <telerik:RadComboBoxItem Text="8 hours" Value="480" />
                                        <telerik:RadComboBoxItem Text="9 hours" Value="540" />
                                        <telerik:RadComboBoxItem Text="10 hours" Value="600" />
                                        <telerik:RadComboBoxItem Text="11 hours" Value="660" />
                                        <telerik:RadComboBoxItem Text="12 hours" Value="720" />
                                        <telerik:RadComboBoxItem Text="18 hours" Value="1080" />
                                        <telerik:RadComboBoxItem Text="1 day" Value="1440" />
                                        <telerik:RadComboBoxItem Text="2 days" Value="2880" />
                                        <telerik:RadComboBoxItem Text="3 days" Value="4320" />
                                        <telerik:RadComboBoxItem Text="4 days" Value="5760" />
                                        <telerik:RadComboBoxItem Text="1 week" Value="10080" />
                                        <telerik:RadComboBoxItem Text="2 weeks" Value="20160" />
                                    </Items>
                                </telerik:RadComboBox>
                            </div>
                            <div class="footer">
                                <asp:Button runat="server" ID="SubmitButton" Text="Update" OnClick="SubmitButton_Click" />
                                <button onclick="hideForm();" type="button" style="margin-right: 20px;">
                                    Cancel</button>
                            </div>
                            <telerik:RadTimeView ID="SharedTimeView" runat="server">
                            </telerik:RadTimeView>
                            <telerik:RadCalendar ID="SharedCalendar" runat="server" EnableMonthYearFastNavigation="False"
                                EnableMultiSelect="False" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False">
                            </telerik:RadCalendar>
                            <asp:HiddenField runat="server" ID="_originalRecurrenceRule" />
                            <telerik:RadSchedulerRecurrenceEditor runat="server" ID="RadSchedulerRecurrenceEditor1" />
                        </div>
                    </ContentTemplate>
                </telerik:RadDock>
            </asp:Panel>
            <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" TimeZoneOffset="03:00:00"
                SelectedDate="2012-04-16" DayStartTime="08:00:00" DayEndTime="18:00:00" StartEditingInAdvancedForm="false"
                SelectedView="DayView" DataKeyField="Fld_AppId" DataSubjectField="Subject" DataStartField="Fld_AppFtime"
                DataEndField="Fld_AppTtime" DataReminderField="Reminder" DataRecurrenceField="RecurrenceRule"
                DataRecurrenceParentKeyField="RecurrenceParentID" DataSourceID="AppointmentsDataSource"
                OnFormCreating="RadScheduler1_FormCreating" Reminders-Enabled="true" OverflowBehavior="Scroll" StartInsertingInAdvancedForm="false">
                <AdvancedForm Modal="true" />
                <ResourceTypes>
                    <%--telerik:ResourceType KeyField="ID" Name="Room" TextField="RoomName" ForeignKeyField="RoomID"
                        DataSourceID="RoomsDataSource" />--%>
                    <telerik:ResourceType KeyField="doc_id" Name="Doctor" TextField="doc_name" ForeignKeyField="MdiSft_Emp_ID"
                        DataSourceID="UsersDataSource" />
                </ResourceTypes>
                <TimeSlotContextMenuSettings EnableDefault="true" />
                <AppointmentContextMenuSettings EnableDefault="true" />
            </telerik:RadScheduler>
        </contenttemplate>
    </asp:updatepanel>
 
     <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
        <script type="text/javascript">
 
            function openForm() {
 
                var dock = $find("<%= RadDock1.ClientID %>");
                // Center the RadDock on the screen
                var viewPort = $telerik.getViewPortSize();
                var xPos = Math.round((viewPort.width - parseInt(dock.get_width())) / 2);
                var yPos = Math.round((viewPort.height - parseInt(dock.get_height())) / 2);
                $telerik.setLocation(dock.get_element(), { x: xPos, y: yPos });
 
                dock.set_closed(false);
 
                var descriptionTextBox = $get('<%= DescriptionText.ClientID %>');
                descriptionTextBox.focus();
 
                Sys.Application.remove_load(openForm);
            }
 
            function hideForm() {
                var dock = $find("<%= RadDock1.ClientID %>");
                dock.set_closed(true);
 
                return true;
            }
 
            function dockMoved(sender, args) {
                //Return RadDock to his original HTML parent so it gets updated via ajax
                $get("<%= DockPanel.ClientID %>").appendChild(sender.get_element());
            }
   
        </script>
    </telerik:RadScriptBlock>
    
    <asp:SqlDataSource ID="UsersDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SystemConnection %>"
        SelectCommand="SELECT * FROM [doctor_master]" >  </asp:SqlDataSource>         
         
    <asp:SqlDataSource ID="AppointmentsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SystemConnection %>"       
        SelectCommand="SELECT * FROM [Tbl_FixSchedule]" ></asp:SqlDataSource>
       
   <%-- <sds:SessionDataSource ID="AppointmentsDataSource" runat="server" PrimaryKeyFields="ID"
        ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT * FROM [Appointments]"
        InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [UserID], [RoomID], [RecurrenceRule], [RecurrenceParentID], [Annotations], [Description], [Reminder], [LastModified]) VALUES (@Subject, @Start, @End, @UserID, @RoomID, @RecurrenceRule, @RecurrenceParentID, @Annotations, @Description, @Reminder, @LastModified)"
        UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [UserID] = @UserID, [RoomID] = @RoomID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Annotations] = @Annotations, [Description] = @Description, [Reminder] = @Reminder, [LastModified] = @LastModified WHERE [ID] = @ID"
        DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID" ClearSessionOnInitialLoad="True"
        SessionKey="System.Web.UI.Page_AppointmentsDataSource">
        <DeleteParameters>
            <asp:parameter name="ID" type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:parameter name="Subject" type="String" />
            <asp:parameter name="Start" type="DateTime" />
            <asp:parameter name="End" type="DateTime" />
            <asp:parameter name="UserID" type="Int32" />
            <asp:parameter name="RoomID" type="Int32" />
            <asp:parameter name="RecurrenceRule" type="String" />
            <asp:parameter name="RecurrenceParentID" type="Int32" />
            <asp:parameter name="Annotations" type="String" />
            <asp:parameter name="Description" type="String" />
            <asp:parameter name="Reminder" type="String" />
            <asp:parameter name="LastModified" type="String" />
            <asp:parameter name="ID" type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:parameter name="Subject" type="String" />
            <asp:parameter name="Start" type="DateTime" />
            <asp:parameter name="End" type="DateTime" />
            <asp:parameter name="UserID" type="Int32" />
            <asp:parameter name="RoomID" type="Int32" />
            <asp:parameter name="RecurrenceRule" type="String" />
            <asp:parameter name="RecurrenceParentID" type="Int32" />
            <asp:parameter name="Annotations" type="String" />
            <asp:parameter name="Description" type="String" />
            <asp:parameter name="Reminder" type="String" />
            <asp:parameter name="LastModified" type="String" />
        </InsertParameters>
    </sds:SessionDataSource>
    <sds:SessionDataSource ID="RoomsDataSource" runat="server" DisplayWarning="false"
        ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT * FROM [Rooms]">
    </sds:SessionDataSource>
    <sds:SessionDataSource ID="UsersDataSource" runat="server" DisplayWarning="false"
        ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT * FROM [Users]">
    </sds:SessionDataSource>--%>
    </form>
</body>
</html>


Thanks,
Soumya
0
Helen
Telerik team
answered on 21 Aug 2012, 01:31 PM
Hi Soumya,

To run the sample you need to copy the "Telerik.mdf" file(provided in the installation) into the App_Data folder and adjust the "TelerikConnectionString" with your SQLEXPRESS instance:

<connectionStrings>
<add name="TelerikConnectionString" connectionString="Data Source=.\YOUR_SQLEXPRESS_INSTANCE;
AttachDbFilename=|DataDirectory|Telerik.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

1. To avoid the javascript error use the following condition:

protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
{
    RadSchedulerRecurrenceEditor1.ResetLayout();
    if (e.Mode == SchedulerFormMode.Insert || e.Mode == SchedulerFormMode.Edit)
    {
        EditedAppointment = e.Appointment;
        //e.Cancel = true;
    }
    var appointmentToEdit = RadScheduler1.PrepareToEdit(e.Appointment, RadScheduler1.EditingRecurringSeries);
 
    //ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "Sys.Application.add_load(openForm);", true);
    //ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "openForm();", true);
 
    if (!ClientScript.IsStartupScriptRegistered("formScript"))
    {
        ClientScript.RegisterStartupScript(this.GetType(), "formScript", "openForm();", true);
    }
 
    PopulateEditForm(appointmentToEdit);
}

Thus, the "openForm()" javascript function will be registered on the page, but not executed - you should associate it with some event if you want to show RadDock upon add/edit appointment.

2. To show RadDock upon add/edit appointment you should use the approach described in our External Edit in RadDock demo:

protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
{
    RadSchedulerRecurrenceEditor1.ResetLayout();
 
    if (e.Mode == SchedulerFormMode.Insert || e.Mode == SchedulerFormMode.Edit)
    {
        EditedAppointment = e.Appointment;
        e.Cancel = true;
    }
 
    var appointmentToEdit = RadScheduler1.PrepareToEdit(e.Appointment, RadScheduler1.EditingRecurringSeries);
 
    ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "Sys.Application.add_load(openForm);", true);
    PopulateEditForm(appointmentToEdit);
}
Thus, the "openForm()" will be registered on the page and associated with Sys.Application.load event.

3. If you use:

protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
{
    RadSchedulerRecurrenceEditor1.ResetLayout();
 
    if (e.Mode == SchedulerFormMode.Insert || e.Mode == SchedulerFormMode.Edit)
    {
        EditedAppointment = e.Appointment;
        //e.Cancel = true;
    }
 
    var appointmentToEdit = RadScheduler1.PrepareToEdit(e.Appointment, RadScheduler1.EditingRecurringSeries);
 
    ScriptManager.RegisterStartupScript(Page, GetType(), "formScript", "openForm();", true);
 
    PopulateEditForm(appointmentToEdit);
}
This will return "dock is null" error, since the "openForm()" script is loaded before RadDock to be loaded.

I recommend you to use the second approach(also shown in our online demo).

Greetings,
Helen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 21 Aug 2012, 02:09 PM
Hi Helen,
Thanks for the reply.
I am using the second approach(same as in demo),and I am getting the javascript error.I have opened a support ticket (581783 )
attached with my project.Could you please run it at your end?
Thanks,
Soumya
0
SRIDHAR
Top achievements
Rank 1
answered on 07 Feb 2013, 12:35 PM
Hi Telerik Team,

    I have attached the image below please refer it and give me solution... I am getting two set of "Rows" how can I avoid it and also how to avoid vertical scroll bar please let me know. Thank you in advance.
0
Plamen
Telerik team
answered on 08 Feb 2013, 09:24 AM
Hello,

 
Such second row can appear when RadScheduler is grouped by resources as it is on this on-line demo but if you remove the grouping it should disappear. As for the scrollbar you can set the OverflowBehavior="Expand" in order to hide it.

If your scenario is somehow different please share the code that is used to reproduce it.

Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Subodh
Top achievements
Rank 1
answered on 28 Oct 2013, 10:04 AM
Hello Telerik Team,


We are using Telerik Rad Scheduler in DNN. We are facing Performance Issue in Rad Scheduler. I have <AdvanceInsertTemplete> and <AdvanceEditTemplate>, in both template we have same form. both template having many controls with Rad Grid. The problem is, when I click for New Appointment, It will take a time to open the New Appointment form, in between Form_Created event of that Rad Scheduler fired 3 times. I am not able to find why Form_Created fire 3 times. also when I try to  close that form It will also take a time.
It works same with <AdvanceEditTemplate>, It will also fire Form_Created 3 times. It affects on performance.

We are not able to find the Issue. Please suggest us.


Waiting for Reply.


Regards,
Subodh.
0
Plamen
Telerik team
answered on 31 Oct 2013, 11:18 AM
Hi Subodh,

 
I have inspected several scenarios with RadScheduler with Advanced template and in all of them FormCreated event was thrown only once.  Would you please elaborate what else should be done to observe the unusual behavior and be more helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Soumya
Top achievements
Rank 1
Answers by
Soumya
Top achievements
Rank 1
Ivana
Telerik team
Helen
Telerik team
SRIDHAR
Top achievements
Rank 1
Plamen
Telerik team
Subodh
Top achievements
Rank 1
Share this question
or