Customizing Rad Schedular

2 posts, 0 answers
  1. M Fasih
    M Fasih avatar
    2 posts
    Member since:
    May 2012

    Posted 25 May 2012 Link to this post

    Hi All,

    I am facing issue while customizing RadScedular. The event for Edit Appointment/Delete Appointment / Dragging appointment on to different date cell are not firing by the customization I have used so far. Only the thing I can do is to insert new appointment.

    I am sending code & markup of my page:-

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
        <link rel="stylesheet" href="App_Themes/Default/schedular.css" type="text/css" />
        <link rel="stylesheet" href="App_Themes/Default/CustomStyles.css" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        </div>
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
            <Scripts>
    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>
    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>
    <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>
    </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadScheduler ID="radDoctorsScheduler" runat="server" DataDescriptionField="Subject"
            DataEndField="End" DataKeyField="AppointmentID" DataRecurrenceField="RecurrenceRule"
            DataRecurrenceParentKeyField="RecurrenceParentID" DataStartField="Start" DataSubjectField="Subject"
            EnableDescriptionField="True" DayStartTime="08:00:00" DayEndTime="18:00:00" ShowsConfirmationWindowOnDelete="False"
            OnAppointmentInsert="radDoctorsScheduler_AppointmentInsert" OnAppointmentDelete="radDoctorsScheduler_AppointmentDelete" AllowDelete="true" AllowEdit="true" DisplayDeleteConfirmation="false"
            OnAppointmentUpdate="radDoctorsScheduler_AppointmentUpdate" OnAppointmentCommand="radDoctorsScheduler_AppointmentCommand">
          
            
            <InlineInsertTemplate>
                <div id="InlineInsertTemplate" class="rsCustomAppointmentContainer technical">
                    <div>
                    </div>
                    <span class="rsCustomAppointmentContainerInner">
                        <table style="width:100%;border:0px:height:150px" cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="width:25%">
                                     Subject:
                                </td>
                                <td style="width: 75%">
                                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%"
                                        TextMode="MultiLine" Height="20px"></asp:TextBox>   
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 25%">
                                    Doctor:
                                </td>
                                <td style="width: 75%">
                                    <telerik:RadComboBox ID="ddlDoctors" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlDoctors_SelectedIndexChanged"
                                        DataValueField="DoctorID" DataTextField="DoctorName" CssClass="AppointmentTypeSelectorTable"
                                        DataSourceID="DoctorsDS">                            
                                    </telerik:RadComboBox>                             
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 25%">
                                    
                                </td>
                                <td>
                                    <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 25%">
                                </td>
                                <td>
                                    <asp:LinkButton ID="InsertButton"  runat="server"
                                        CommandName="Insert"  >
                                        <asp:Image runat="server" ID="insertImage" ImageUrl="~/App_Themes/Default/Images/ok.png"
                                            AlternateText="insert" />
                                    </asp:LinkButton>
                                    <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                                        <asp:Image runat="server" ID="imgCancel" ImageUrl="~/App_Themes/Default/Images/cancel.png"
                                            AlternateText="cancel" />
                                    </asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </span>
                </div>
            </InlineInsertTemplate>
            
            <InlineEditTemplate>
                <div id="InlineEditTemplate" class="rsCustomAppointmentContainer technical">
                    <div>
                    </div>
                    <span class="rsCustomAppointmentContainerInner">
                        <table style="width: 100%; border: 0px:height:150px" cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="width: 25%">
                                    Subject:
                                </td>
                                <td style="width: 75%">
                                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%"
                                        TextMode="MultiLine" Height="20px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 25%">
                                    Doctor:
                                </td>
                                <td style="width: 75%">
                                    <telerik:RadComboBox ID="ddlDoctors" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlDoctors_SelectedIndexChanged"
                                        DataValueField="DoctorID" DataTextField="DoctorName" CssClass="AppointmentTypeSelectorTable"
                                        DataSourceID="DoctorsDS">
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 25%">
                                </td>
                                <td>
                                    <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 25%">
                                </td>
                                <td>
                                    <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                        <asp:Image runat="server" ID="insertImage" ImageUrl="~/App_Themes/Default/Images/ok.png"
                                            AlternateText="insert" />
                                    </asp:LinkButton>
                                    <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                                        <asp:Image runat="server" ID="imgCancel" ImageUrl="~/App_Themes/Default/Images/cancel.png"
                                            AlternateText="cancel" />
                                    </asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </span>
                </div>
            </InlineEditTemplate>
            
        </telerik:RadScheduler>
        <asp:SqlDataSource ID="IDSAppointments" runat="server" ConnectionString="<%$ ConnectionStrings:SchedularDBConnectionString %>"
            InsertCommand="[spInsertUpdateAppointment] null,@DoctorID,@Start, @End, @Subject, @RecurrenceRule, @RecurrenceParentID"
            UpdateCommand="[spInsertUpdateAppointment] @AppointmentID,@DoctorID,@Start,@End,@Subject,@RecurrenceRule,@RecurrenceParentID"
            DeleteCommand="[spDeleteAppointment] @AppointmentID" SelectCommand="[spGetAllAppointments]">
            <DeleteParameters>
                <asp:Parameter Name="AppointmentID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter DbType="Date" Name="Start" />
                <asp:Parameter DbType="Date" Name="End" />
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
                <asp:Parameter Name="AppointmentID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter DbType="Date" Name="Start" />
                <asp:Parameter DbType="Date" Name="End" />
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="RecurrenceRule" Type="String" />
                <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
        
        <asp:SqlDataSource ID="DoctorsDS" runat="server" ProviderName="System.Data.SqlClient"
            ConnectionString="<%$ ConnectionStrings:SchedularDBConnectionString %>" SelectCommand="SELECT * FROM [Doctors]">
        </asp:SqlDataSource>
        
        <asp:HiddenField runat="server" ID="hdnDoctorID" />
        
        
        </form>
    </body>
    </html>

    //////////////////////////////////////////////////////////////////////////////
    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.ComponentModel;
    using Telerik.Web.UI;

    public partial class Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void radDoctorsScheduler_AppointmentInsert(object sender, Telerik.Web.UI.AppointmentInsertEventArgs e)
        {
            Appointment apt = e.Appointment;
            DAL.InsertUpdateAppointment(0, Convert.ToInt32(hdnDoctorID.Value), apt.Start, apt.End, apt.Subject, apt.RecurrenceRule, Convert.ToInt32(apt.RecurrenceParentID));
        }
        protected void ddlDoctors_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RadComboBox ddlDoctors = (RadComboBox)sender;
            hdnDoctorID.Value = ddlDoctors.SelectedValue;
        }
        protected void radDoctorsScheduler_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
        {
            Appointment apt = e.Appointment;
            DAL.InsertUpdateAppointment(Convert.ToInt32(apt.ID), Convert.ToInt32(hdnDoctorID.Value), apt.Start, apt.End, apt.Subject, apt.RecurrenceRule, Convert.ToInt32(apt.RecurrenceParentID));
        }
        protected void radDoctorsScheduler_AppointmentDelete(object sender, AppointmentDeleteEventArgs e)
        {
            Appointment apt = e.Appointment;
            DAL.DeleteAppointment(Convert.ToInt32(apt.ID));


            radDoctorsScheduler.DeleteAppointment(e.Appointment, true);


            //radDoctorsScheduler.Appointments[0].Re.Remove(e.Appointment.ID);  
        }
        protected void radDoctorsScheduler_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
        {

        }
    }

    Please suggest why events of schedular are not firing up?

  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 28 May 2012 Link to this post

    Hello Farish,

    I did not manage to replicate the issue you experience at my end. Here is what I have tested: http://screencast.com/t/GLikxxWsHqpo. Am I missing something?

    All the best,
    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.
Back to Top