Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
153 views
I'm using a RadUpload in radwindow and when I check the UploadedFiles.Count within my InsertCommand, it returns 0.  Any ideas what I'm doing wrong?

 <telerik:RadUpload ID="RUImg" runat="server" InitialFileInputsCount="1" Width="340">
  </telerik:RadUpload>

code behind

    foreach (UploadedFile file in RUImg.UploadedFiles)
            {
                try
                {
                    file.SaveAs("D:\\Projet\\Intranet\\O2-PowerNet\\images_app\\AnnonceImages\\" + file.GetName(), true);

                }
                catch (Exception ex) {
               
                }
            }
Genady Sergeev
Telerik team
 answered on 15 May 2013
1 answer
91 views
Hi,

I'm getting the following error when I call the page size changed event. I've attached a screen shot. Appreciate your help.

Thanks,
Ron.
Pavlina
Telerik team
 answered on 15 May 2013
1 answer
1.0K+ views
Hi
     How can I remove the refresh button from the top of the radgrid??
thanks
Allen
Shinu
Top achievements
Rank 2
 answered on 15 May 2013
1 answer
187 views
Hi,

Is it possible to add a background image to radcombobox dropdown?

Thanks,
Tia
Princy
Top achievements
Rank 2
 answered on 15 May 2013
1 answer
146 views
I have a function to handle validation on my single click radbutton, how do I toggle the state of the single click in JS, currently the button remains with it's SingleClickText if the script below doesn't validate

<script type="text/javascript">
            function DoSubscriptionValidation(button, args) {
                var isValid = Page_ClientValidate('Subscription');
                if (isValid) {
                    $find("<%= SubscriptionErrorNotification.ClientID %>").hide();
                }
                else {
                    $find("<%= SubscriptionErrorNotification.ClientID %>").show();
                }
                button.set_autoPostBack(isValid);
            }
        </script>
Danail Vasilev
Telerik team
 answered on 15 May 2013
1 answer
143 views
Hi,
I have datePicker control in User control and would like to compare the date with date Picker in  Parent Page date picker control value using Javascript. Could you please let me know?

 

 


<
telerik:RadButton runat="server" Enabled="true" ID="btnSave" Text="Upload" OnClientClicked="OnClientClicked"

 

 

 

/>

 



Thank you.
Viktor Tachev
Telerik team
 answered on 15 May 2013
2 answers
154 views
Hi devs,

I have built an OrgChart where the user can dynamically add items to elements of the OrgChart.

I use a LinkButton control inside the template, so that each item can have new items added to it. What I am finding is that adding items off the root object and subsequent children objects works 100% until you drill down to view the layer below. It is only then that the LinkButton stops working all together. I have also added a hyperlink to show the ID of the object to the user to confirm that the linkage is in place, and it works regardless of what layer you view.

I have attached the code below - please note that this is a sample to demonstrate the issue, but my production code is exactly the same when it comes to the core functionality.

Any thoughts??

aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="OrgChartIssue.aspx.vb" Inherits="OrgChartIssue" %>
 
<!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:RadAjaxPanel runat="server" ID="RadAjaxPanel" >
            <telerik:RadOrgChart runat="server" ID="RadOrgChart1" DisableDefaultImage="true" EnableDrillDown="true" MaxDataBindDepth="2" EnableViewState="true" >
                <ItemTemplate>
                    <table width="100%" cellpadding="0" cellspacing="0">
                        <tr align="left">
                            <td><strong>Name:</strong> <%#DataBinder.Eval(Container.DataItem, "Name")%></td>
                        </tr>
                        <tr align="left">
                            <td><strong>Created:</strong> <%#DataBinder.Eval(Container.DataItem, "Created")%></td>
                        </tr>
                        <tr align="right">
                            <td>
                                <asp:LinkButton runat="server" ID="lbAdd" OnCommand="lbAdd_Command" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "OrganisationId")%>'>Add</asp:LinkButton>  
                                <a href="#" onclick="alert('<%#DataBinder.Eval(Container.DataItem, "OrganisationId")%>');"  >Edit</a>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </telerik:RadOrgChart>
        </telerik:RadAjaxPanel>
 
    </form>
</body>
</html>


code behind
Public Class OrgChartIssue
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        If IsNothing(Session("DemoData")) = True Then
            'set the data table up and add a default record to start with
            InitData()
        End If
 
        RadOrgChart1.DataSource = GetData()
        RadOrgChart1.DataFieldID = "OrganisationId"
        RadOrgChart1.DataTextField = "Name"
        RadOrgChart1.DataFieldParentID = "ParentOrganisationId"
        RadOrgChart1.DataBind()
    End Sub
 
    Private Function GetData() As DataTable
        'return the session object
        Return Session("DemoData")
    End Function
 
    Protected Sub lbAdd_Command(sender As Object, e As CommandEventArgs)
        'bring back the data table
        Dim Org As DataTable = DirectCast(Session("DemoData"), DataTable)
 
        'increment the key index
        Dim NextID = Org.Rows.Count + 1
 
        'add the new item
        Dim NewRec As DataRow = Org.NewRow
        NewRec.Item("OrganisationID") = NextID
        NewRec.Item("Name") = "Default New Name " & NextID
        NewRec.Item("ParentOrganisationId") = CInt(e.CommandArgument)
        NewRec.Item("Created") = Now.ToString
 
        Org.Rows.Add(NewRec)
        'put the data table back in to session
        Session("DemoData") = Org
 
        Debug.Print(String.Format("Item {0} added to parent {2} at {1}", NextID, Now.ToString, e.CommandArgument))
 
        'refresh the page
        Response.Redirect("OrgChartIssue.aspx", True)
 
    End Sub
 
    Private Sub InitData()
        Dim Org As New DataTable
 
        Org.Columns.Add("OrganisationId")
        Org.Columns.Add("Name")
        Org.Columns.Add("ParentOrganisationId")
        Org.Columns.Add("Created")
 
        'need a starting / default root object
        Org.Rows.Add("1", "Root of the Organisation", Nothing, Now.ToString)
 
        Session("DemoData") = Org
    End Sub
 
End Class

Bryan
Top achievements
Rank 1
 answered on 15 May 2013
4 answers
166 views
Hi,

I need to get a Textbox to show inside a ContextMenu control. If this is possible, can you provide some directions to get this done. If it's not possible, can you provide suggestions on how I can accomplish this.

Thanks. 
Kate
Telerik team
 answered on 15 May 2013
1 answer
142 views

1) I have created Visual Webpart in sharepoint 2010 and parent User control is named "WPScedulerSharepointWebpartUserControl.ascx"

2) Added AdvancedForm.ascx in control template of sharepoint and the same I have register in WPScedulerSharepointWebpartUserControl.ascx

3) I have implemented Radscheduler along with advanceForm.ascx  control . In Visual studio 2010 webpart

My issues are I am not able to get the public properties values from AdvancedForm.ascx to WPScedulerSharepointWebpartUserControl.ascx and Vice Versa.

I am attaching the code for each web part user controls and there code behind below

a) WPScedulerSharepointWebpartUserControl.ascx"

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WPScedulerSharepointWebpartUserControl.ascx.cs"
    Inherits="OnCallSolution.WPScedulerSharepointWebpart.WPScedulerSharepointWebpartUserControl" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2013.1.403.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="scheduler" TagName="AdvancedForm" Src="~/_controltemplates/OnCallSolution/AdvancedForm.ascx" %>

<link rel="Stylesheet" type="text/css" href="/_layouts/OnCallSolution/StyleOnCall.css" />
<script type="text/javascript"> 
  //<![CDATA[

    // Dictionary containing the advanced template client object
    // for a given RadScheduler instance (the control ID is used as key).
    var schedulerTemplates = {};

    function schedulerFormCreated(scheduler, eventArgs) {
       
        // Create a client-side object only for the advanced templates
        var mode = eventArgs.get_mode();
        if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
     mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
            // Initialize the client-side object for the advanced form
            var formElement = eventArgs.get_formElement();
            var templateKey = scheduler.get_id() + "_" + mode;
            var advancedTemplate = schedulerTemplates[templateKey];
            if (!advancedTemplate) {
                // Initialize the template for this RadScheduler instance
                // and cache it in the schedulerTemplates dictionary
                var schedulerElement = scheduler.get_element();
                var isModal = scheduler.get_advancedFormSettings().modal;
                advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement, isModal);
                advancedTemplate.initialize();

                schedulerTemplates[templateKey] = advancedTemplate;

                // Remove the template object from the dictionary on dispose.
                scheduler.add_disposing(function () {
                    schedulerTemplates[templateKey] = null;
                });
            }

            // Are we using Web Service data binding?
            if (!scheduler.get_webServiceSettings().get_isEmpty()) {
                // Populate the form with the appointment data
                var apt = eventArgs.get_appointment();
                var isInsert = mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert;
                advancedTemplate.populate(apt, isInsert);
            }
        }
    }
   
  //]]>
</script>
<style type="text/css">
    div.RadScheduler .rsHorizontalHeaderTable, div.RadScheduler .rsContentTable
    {
        width: /*\**/ 100%\9 !important;
    }
    * + html div.RadScheduler .rsHorizontalHeaderTable, * + html div.RadScheduler .rsContentTable
    {
        width: auto !important;
    }
</style>
<script type="text/javascript">
    //    function validationFunctionSubjectContinentsRadComboBox(source, arguments) {
    //        if (arguments.Value.length > 0) {
    //            arguments.IsValid = true;
    //        }
    //        else {
    //            arguments.IsValid = false;
    //        }
    //    }
</script>
<script type="text/javascript">

    Sys.Application.add_init(function () {
        (function () {

            var $,
 $T,
 $DateTime,
 timePerMinute = 60000,
 timePerHour = timePerMinute * 60,
 timePerDay = timePerHour * 24,
 maxInt = 2147483647,
 maxDate = new Date("9000/01/01"),
 toolTipZIndex = 10000,
 resourceControlSuffix = "_ResourceValue";

            window.SchedulerAdvancedTemplate = function (schedulerElement, formElement, isModal) {
                $ = $telerik.$;
                $T = Telerik.Web.UI;
                $DateTime = $T.Scheduler.DateTime;

                this._scheduler = $find(schedulerElement.id);
                this._schedulerElement = schedulerElement;
                this._formElement = formElement;
                this._schedulerElementId = this._schedulerElement.id;
                this._isModal = isModal;
                this._eventNamespace = schedulerElement.id;

                // We need to obtain the ID of the naming container that
                // contains the advanced template. We can find it from
                // the ID of a known element hosted in the form,
                // such as BasicControlsPanel.
                var basicControlsPanel = $("div.rsAdvBasicControls", formElement);
                if (basicControlsPanel.length == 0)
                    return;

                var basicControlsPanelId = basicControlsPanel[0].id;
                this._templateId = basicControlsPanelId.substring(0, basicControlsPanelId.lastIndexOf("_"));
            };

            window.SchedulerAdvancedTemplate._adjustHeight = function (schedulerElement) {
                // Stretches the rsAdvOptions div to the available height.
                var advancedEditDiv = $("div.rsAdvancedEdit:visible", schedulerElement);
                var contentWrapper = $(".rsAdvContentWrapper", advancedEditDiv);
                var excludedBorders = advancedEditDiv.outerHeight() - advancedEditDiv.height();
                excludedBorders += contentWrapper.outerHeight() - contentWrapper.height();

                var titleHeight = $("div.rsAdvTitle:visible", schedulerElement).outerHeight({ margin: true });

                var buttonsDiv = $("div.rsAdvancedSubmitArea", advancedEditDiv);
                var buttonsHeight = buttonsDiv.outerHeight({ margin: true });

                var targetHeight = $(schedulerElement).height() - titleHeight - buttonsHeight - excludedBorders;
                $(".rsAdvOptionsScroll", advancedEditDiv).height(targetHeight + "px");

                // IE fix
                if (buttonsDiv[0])
                    buttonsDiv[0].style.cssText = buttonsDiv[0].style.cssText;
            };

            window.SchedulerAdvancedTemplate.prototype =
{
    initialize: function () {
        var scheduler = this._scheduler;
        scheduler.add_disposing(Function.createDelegate(this, this.dispose));

        // Enable the buttons in the advanced form
        $("div.rsAdvancedSubmitArea a", this._formElement).attr("onclick", "");

        if (scheduler.get_overflowBehavior() == 1 && !this._isModal)
            window.SchedulerAdvancedTemplate._adjustHeight(this._schedulerElement);

        this._initializePickers();
        this._initializeAdvancedFormValidators();
        this._initializeAllDayCheckbox();

        var recurrenceSupport = this._getRecurrenceEditor() != null;
        if (recurrenceSupport) {
            this._initializeResetExceptions();
        }

        if ($telerik.isIE) {
            var textarea = this._getSubjectTextBox().get_element();
            textarea.style.cssText = textarea.style.cssText;
        }

        // Exclude the spin button arrows from the tab order
        $('.riUp, .riDown', this._formElement).attr("tabindex", "-1");
    },

    dispose: function () {
        if (!this._formElement)
            return;

        $("*", this._formElement).unbind();
        $(document).unbind("." + this._eventNamespace);

        this._pickers = null;
        this._scheduler = null;
        this._schedulerElement = null;
        this._formElement = null;
    },

    // The populate function is needed only when using Web Service data binding.
    populate: function (apt, isInsert) {
        if (!this._clientMode)
            this._initializeClientMode();

        this._appointment = apt;
        this._isInsert = isInsert;

        var isAllDay =
            $DateTime.getTimeOfDay(apt.get_start()) == 0 &&
            $DateTime.getTimeOfDay(apt.get_end()) == 0;

        var aptEndDate = $DateTime.getDate(apt.get_end());
        if (isAllDay)
            aptEndDate = $DateTime.add(aptEndDate, -timePerDay);

        this._getSubjectTextBox().set_value(apt.get_subject());

        var descrTextBox = this._getDescriptionTextBox();
        if (descrTextBox)
            descrTextBox.set_value(apt.get_description());

        this._pickers.startDate.set_selectedDate($DateTime.getDate(apt.get_start()));
        this._pickers.startTime.set_selectedDate(apt.get_start());
        this._pickers.endDate.set_selectedDate(aptEndDate);
        this._pickers.endTime.set_selectedDate(apt.get_end());

        this._populateResources();
        this._populateAttributes();

        this._initalizeResetExceptionsClientMode();

        var allDayCheckBox = $("#" + this._templateId + "_AllDayEvent");
        if (isAllDay != allDayCheckBox[0].checked) {
            allDayCheckBox[0].checked = isAllDay;
            this._onAllDayCheckBoxClick(isAllDay, false);
        }

        this._populateRecurrence();
        this._populateReminder();
        this._populateTimeZones();
    },

    _initializeClientMode: function () {
        this._clientMode = true;
        var template = this;

        $("a.rsAdvEditSave", this._formElement)
            .click(function (e) {
                template._saveClicked();
                $telerik.cancelRawEvent(e);
            })
            .attr("href", "#");

        $("a.rsAdvEditCancel, a.rsAdvEditClose", this._formElement)
            .click(function (e) {
                template._cancelClicked();
                $telerik.cancelRawEvent(e);
            })
            .attr("href", "#");
    },

    _initalizeResetExceptionsClientMode: function () {
        var resetExceptions = $("span.rsAdvResetExceptions > a", this._formElement);
        var hasExceptions = this._appointment.get_recurrenceRule().indexOf("EXDATE") != -1;

        resetExceptions.unbind();

        if (hasExceptions) {
            var template = this;
            var localization = this._scheduler.get_localization();
            resetExceptions
                .attr("href", "#")
                .text(localization.AdvancedReset)
                .click(function () {
                    // Display confirmation dialog
                    template._getRemoveExceptionsDialog()
                        .set_onActionConfirm(function () {
                            // The user has confirmed - proceed
                            template._scheduler.removeRecurrenceExceptions(template._appointment);
                            resetExceptions.text(localization.AdvancedDone);
                        })
                        .show();

                    return false;
                });
        }
        else {
            resetExceptions.text("");
        }
    },

    // Click handler for the "Save" button
    _saveClicked: function () {
        if (typeof (Page_ClientValidate) != "undefined") {
            var validationGroup = this._scheduler.get_validationGroup() + (this._isInsert ? "Insert" : "Edit");
            if (!Page_ClientValidate(validationGroup))
                return;
        }

        var apt = this._appointment;
        apt.set_subject(this._getSubjectTextBox().get_value());

        //        //By LTI addeded
        //        var apt = this._getContinentsRadComboBox;
        //        apt.set_subject(this._getContinentsRadComboBox.get_value());

        //        var apt = this._getCountriesRadComboBox;
        //        apt.set_subject(this._getCountriesRadComboBox.get_value());
        //        //end LTI

        var descrTextBox = this._getDescriptionTextBox();
        if (descrTextBox)
            apt.set_description(descrTextBox.get_value());

        var isAllDay = $get(this._templateId + "_AllDayEvent").checked;

        var startDate = this._pickers.startDate.get_selectedDate();
        var startTime = $DateTime.getTimeOfDay(this._pickers.startTime.get_selectedDate());
        apt.set_start($DateTime.add(startDate, isAllDay ? 0 : startTime));

        var endDate = this._pickers.endDate.get_selectedDate();
        var endTime = $DateTime.getTimeOfDay(this._pickers.endTime.get_selectedDate());
        apt.set_end($DateTime.add(endDate, isAllDay ? timePerDay : endTime));

        this._saveResources(apt);
        this._saveAttributes(apt);

        this._saveRecurrenceRule(apt);
        this._saveReminder(apt);
        this._saveTimeZone(apt);

        if (this._isInsert)
            this._scheduler.insertAppointment(apt);
        else
            this._scheduler.updateAppointment(apt);

        this._scheduler.hideAdvancedForm();
    },

    _cancelClicked: function () {
        this._scheduler.hideAdvancedForm();
    },

    _saveResources: function (apt) {
        var template = this;
        var schedulerResources = this._scheduler.get_resources();

        this._scheduler.get_resourceTypes().forEach(function (resourceType) {
            var resourceTypeName = resourceType.get_name();
            var baseName = template._templateId + "_Res" + resourceTypeName + resourceControlSuffix;
            var resourcesOfThisType = schedulerResources.getResourcesByType(resourceTypeName);

            if (resourceType.get_allowMultipleValues()) {
                var checkBoxes = $(String.format("input[id*='{0}']", baseName), this._formElement);

                if (checkBoxes.length > 0)
                    apt.get_resources().removeResourcesByType(resourceTypeName);

                for (var i = 0; i < checkBoxes.length; i++) {
                    if (checkBoxes[i].checked && resourcesOfThisType.get_count() >= i)
                        apt.get_resources().add(resourcesOfThisType.getResource(i));
                };
            }
            else {
                var dropDown = $find(baseName);
                if (!dropDown)
                    return;

                apt.get_resources().removeResourcesByType(resourceTypeName);

                if (dropDown.get_selectedIndex() == 0)
                    return;

                var selectedValue = dropDown.get_selectedItem().get_value();
                var newResource = schedulerResources.findAll(function (res) {
                    return res.get_type() == resourceTypeName &&
                           res._getInternalKey() == selectedValue;
                }).getResource(0) || null;

                if (newResource)
                    apt.get_resources().add(newResource);
            }
        });
    },

    _saveAttributes: function (apt) {
        var template = this;
        var aptAttributes = apt.get_attributes();
        $.each(this._scheduler.get_customAttributeNames(), function () {
            var attrName = this.toString();
            var textBox = $find(template._templateId + "_Attr" + attrName);
            if (!textBox)
                return;

            aptAttributes.removeAttribute(attrName);
            aptAttributes.setAttribute(attrName, textBox.get_value());
        });
    },

    _getResourceIndex: function (res) {
        var resources = this._scheduler.get_resources().getResourcesByType(res.get_type());
        var index, length;

        for (index = 0, length = resources.get_count(); index < length; index++) {
            var filteredRes = resources.getResource(index);
            if (filteredRes.get_type() == res.get_type() && filteredRes.get_key() == res.get_key())
                return index;
        };

        return -1;
    },

    _populateResources: function () {
        var template = this;
        var resourceTypes = this._scheduler.get_resourceTypes();

        resourceTypes.forEach(function (resType) {
            var baseName = template._templateId + "_Res" + resType.get_name() + resourceControlSuffix;

            if (resType.get_allowMultipleValues()) {
                // Clear the resource checkboxes
                $(String.format("input[id*='{0}']", baseName), this._formElement)
                    .each(function () {
                        this.checked = false;
                    });
            }
            else {
                var dropDown = $find(baseName);
                if (dropDown)
                    dropDown.get_items().getItem(0).select();
            }
        });

        this._appointment.get_resources().forEach(function (res) {
            var baseName = template._templateId + "_Res" + res.get_type() + resourceControlSuffix;
            var resType = resourceTypes.getResourceTypeByName(res.get_type());
            if (resType && resType.get_allowMultipleValues()) {
                var resIndex = template._getResourceIndex(res);
                var checkBox = $get(baseName + "_" + resIndex);

                if (checkBox)
                    checkBox.checked = true;
            }
            else {
                var dropDown = $get(baseName);
                if (dropDown)
                    template._selectDropDownValue(dropDown, res._getInternalKey());
            }
        });
    },

    _populateAttributes: function () {
        var template = this;
        this._appointment.get_attributes().forEach(function (attr, attrValue) {
            var textBox = $find(template._templateId + "_Attr" + attr);
            if (!textBox)
                return;

            textBox.set_value(attrValue);
        });
    },

    _saveRecurrenceRule: function (apt) {
        var editor = this._getRecurrenceEditor();
        if (!editor) return;

        editor.set_startDate(this._scheduler.displayToUtc(apt.get_start()));
        editor.set_endDate(this._scheduler.displayToUtc(apt.get_end()));
        editor.set_firstDayOfWeek(this._scheduler.get_firstDayOfWeek());

        var rrule = editor.get_recurrenceRule();
        if (!rrule) {
            apt.set_recurrenceRule("");
            return;
        }

        // Restore the original recurrence exceptions if the
        // appointment was already recurring.
        var originalRRule = $T.RecurrenceRule.parse(apt.get_recurrenceRule());
        if (originalRRule)
            Array.addRange(rrule.get_exceptions(), originalRRule.get_exceptions());

        var range = rrule.get_range();
        if (range.get_recursUntil().getTime() != maxDate.getTime()) {
            var recursUntil = this._scheduler.displayToUtc(range.get_recursUntil());

            if (!this._getElement("AllDayEvent").checked)
                recursUntil = $DateTime.add(recursUntil, timePerDay);

            range.set_recursUntil(recursUntil);
        }

        apt.set_recurrenceRule(rrule.toString());
    },

    _saveTimeZone: function (apt) {
        var timeZonesDropDown = this._getTimeZonesDropDown();
        if (!timeZonesDropDown) return;

        var selectedValue = timeZonesDropDown.get_value();
        if (selectedValue != this._scheduler._timeZoneID)
            apt.set_timeZoneID(selectedValue);

    },

    _saveReminder: function (apt) {
        var reminderDropDown = this._getReminderDropDown();
        if (!reminderDropDown) return;

        var selectedValue = reminderDropDown.get_value();
        var aptReminders = apt.get_reminders();
        if (selectedValue) {
            var reminderMinutes = parseInt(selectedValue, 10);
            if (aptReminders.get_count() > 0) {
                aptReminders.getReminder(0).set_trigger(reminderMinutes);
            }
            else {
                var reminder = new $T.Reminder();
                reminder.set_trigger(reminderMinutes);
                aptReminders.add(reminder);
            }
        }
        else {
            if (aptReminders.get_count() > 0)
                aptReminders.removeAt(0);
        }
    },

    _populateRecurrence: function () {
        var editor = this._getRecurrenceEditor();
        if (!editor) return;

        var rrule = $T.RecurrenceRule.parse(this._appointment.get_recurrenceRule());
        if (rrule) {
            var range = rrule.get_range();
            var recursUntil = range.get_recursUntil().getTime();
            if (recursUntil != maxDate.getTime()) {
                recursUntil = this._scheduler.utcToDisplay(range.get_recursUntil());

                if (!this._getElement("AllDayEvent").checked)
                    recursUntil = $DateTime.add(recursUntil, -timePerDay);

                range.set_recursUntil(recursUntil);
            }
        }
        else {
            editor.set_startDate(this._appointment.get_start());
            editor.set_endDate(this._appointment.get_end());
        }

        editor.set_recurrenceRule(rrule);
    },

    _populateTimeZones: function () {
        var timeZonesDropDown = this._getTimeZonesDropDown();
        if (!timeZonesDropDown) return;

        var timeZone = this._appointment.get_timeZoneID();
        if (!timeZone)
            this._selectDropDownValue(timeZonesDropDown.get_element(), this._scheduler._timeZoneId);
        else
            this._selectDropDownValue(timeZonesDropDown.get_element(), timeZone);
    },

    _populateReminder: function () {
        var reminderDropDown = this._getReminderDropDown();
        if (!reminderDropDown) return;

        var reminder = this._appointment.get_reminders().getReminder(0);
        if (!reminder)
            this._selectDropDownValue(reminderDropDown.get_element(), "");
        else
            this._selectDropDownValue(reminderDropDown.get_element(), reminder.get_trigger());
    },

    _selectDropDownValue: function (dropDown, value) {
        var comboBox = $find(dropDown.id);
        if (comboBox && $T.RadComboBox.isInstanceOfType(comboBox)) {
            comboBox.get_items().forEach(function (item) {
                if (item.get_value() == value)
                    item.select();
            });
        }
        else {
            $.each(dropDown.options, function () {
                if (this.value == value) {
                    this.selected = true;
                    return false;
                }
            });
        }
    },

    _getSubjectTextBox: function () {
        return $find(this._templateId + "_SubjectText");
    },

    //    //By LTI Add

    //    _getContinentsRadComboBox: function () {
    //        return this._getControl("ContinentsRadComboBox")
    //    },

    //    _getCountriesRadComboBox: function () {
    //        return this._getControl("CountriesRadComboBox")
    //    },
    //    //end LTI

    _getDescriptionTextBox: function () {
        return $find(this._templateId + "_DescriptionText");
    },

    _getRecurrenceEditor: function () {
        return $find(this._templateId + "_AppointmentRecurrenceEditor");
    },

    _getReminderDropDown: function () {
        return this._getControl("ReminderDropDown")
    },

    _getTimeZonesDropDown: function () {
        return this._getControl("TimeZonesDropDown")
    },

    _getElement: function (id) {
        return $get(this._templateId + "_" + id);
    },

    _getControl: function (id) {
        return $find(this._templateId + "_" + id);
    },

    _initializePickers: function () {
        // Show picker pop-ups when the inputs are focused

        var showPopupDelegate = Function.createDelegate(this, this._showPopup);

        var templateId = this._templateId;
        this._pickers =
  {
      "startDate": $find(templateId + "_StartDate"),
      "endDate": $find(templateId + "_EndDate"),
      "startTime": $find(templateId + "_StartTime"),
      "endTime": $find(templateId + "_EndTime")
  };

        $.each(
   this._pickers,
   function () {
       if (this && this.get_dateInput)
           this.get_dateInput().add_focus(showPopupDelegate);
   });

        var pickerControls = [
     $get(this._pickers.startDate.get_element().id + "_wrapper"),
     $get(this._pickers.startTime.get_element().id + "_wrapper"),
     $get(this._pickers.startTime.get_element().id + "_timeView_wrapper"),
     $get(this._pickers.endDate.get_element().id + "_wrapper"),
     $get(this._pickers.endTime.get_element().id + "_wrapper"),
     $get(this._pickers.endTime.get_element().id + "_timeView_wrapper"),
     $get(this._templateId + "_SharedCalendar")
    ];

        // Hide the pickers when the focus moves to another element in the template
        var advancedTemplate = this;
        var eventName = "focusin";

        $(this._formElement).bind(eventName,
   function (e) {
       var inPickerControls = false;
       for (var i = 0, len = pickerControls.length; i < len; i++) {
           var control = pickerControls[i];
           if ($telerik.isDescendantOrSelf(control, e.target)) {
               inPickerControls = true;
               break;
           }
       }

       if (!inPickerControls)
           advancedTemplate._hidePickerPopups();
   });

        // Custom jQuery event fired when the pop-up advanced
        // form has been moved.
        $(this._formElement).bind("formMoving", function () {
            advancedTemplate._hidePickerPopups();
        });

        if (this._isModal)
            $(document).bind("scroll." + this._eventNamespace, function () {
                advancedTemplate._hidePickerPopups();
            });
    },

    _initializeAdvancedFormValidators: function () {
        var toolTip = this._createValidatorToolTip();

        if (typeof (Page_Validators) == "undefined")
            return;

        for (var validatorIndex in Page_Validators) {
            var validator = Page_Validators[validatorIndex];
            if (this._validatorIsInTemplate(validator)) {
                var control = $("#" + validator.controltovalidate);
                if (control.length == 0)
                    break;

                if (control.parent().is(".rsAdvDatePicker") ||
     control.parent().is(".rsAdvTimePicker")) {
                    $("#" + validator.controltovalidate + "_dateInput")
      .bind("focus", { "toolTip": toolTip }, this._showToolTip)
      .bind("blur", { "toolTip": toolTip }, this._hideToolTip)
      [0].errorMessage = validator.errormessage;
                }
                else {
                    control.addClass("rsValidatedInput");
                }

                control[0].errorMessage = validator.errormessage;
                this._updateValidator(validator, control);
            }
        }

        var advancedTemplate = this;
        var originalValidatorUpdateDisplay = ValidatorUpdateDisplay;

        ValidatorUpdateDisplay = function (validator) {
            if (advancedTemplate._validatorIsInTemplate(validator) && validator.controltovalidate) {
                advancedTemplate._updateValidator(validator);
            }
            else {
                originalValidatorUpdateDisplay(validator);
            }
        };

        $(".rsValidatedInput", this._formElement)
   .bind("focus", { "toolTip": toolTip }, this._showToolTip)
   .bind("blur", { "toolTip": toolTip }, this._hideToolTip);
    },

    _initializeAllDayCheckbox: function () {
        var allDayCheckbox = $("#" + this._templateId + "_AllDayEvent");
        var controlList = $(allDayCheckbox[0].parentNode.parentNode.parentNode);
        var timePickers = controlList.find('.rsAdvTimePicker');

        // RadDateTimePicker-display-hackedy-hack
        if ($telerik.isIE6 || $telerik.isIE7) {
            $('.rsAdvTimePicker, .rsAdvDatePicker', this._formElement).css(
   {
       display: "inline",
       zoom: 1,
       width: ""
   });
        }
        else {
            $('.rsAdvTimePicker, .rsAdvDatePicker', this._formElement).css(
   {
       display: "inline-block",
       width: ""
   });
        }

        var timePickersWidth = $("#" + this._templateId + "_StartTime_dateInput").outerWidth();

        timePickers.width(timePickersWidth);

        var initialPickersWidth = $(".rsTimePick", this._formElement).eq(0).outerWidth();
        var allDayPickersWidth = initialPickersWidth - timePickersWidth;

        var startTimeValidator = $get(this._templateId + "_StartTimeValidator");
        var endTimeValidator = $get(this._templateId + "_StartTimeValidator");

        var advancedTemplate = this;

        // IE fix - the hidden input pushes down the other TimePicker elements during animation
        controlList.find('.rsAdvTimePicker > input').css("display", "none");

        var clickHandler = function (allDay, animate) {
            var showTimePickers = function () {
                if ($telerik.isSafari || $telerik.isOpera)
                    timePickers.css("display", "inline-block");
                else
                    timePickers.show();
            };

            if (!allDay)
                showTimePickers();

            controlList.find('.rsTimePick').each(function () {
                if (animate) {
                    $(this).stop();

                    if (allDay)
                        $(this).animate({ width: allDayPickersWidth }, "fast",
       "linear", function () { timePickers.hide(); });
                    else
                        $(this).animate({ width: initialPickersWidth }, "fast");
                }
                else {
                    if (allDay) {
                        timePickers.hide();
                        $(this).width(allDayPickersWidth);
                    }
                    else {
                        $(this).width(initialPickersWidth);
                    }
                }
            });

            if (typeof (ValidatorEnable) != "undefined") {
                ValidatorEnable(startTimeValidator, !allDay);
                ValidatorEnable(endTimeValidator, !allDay);
            }

            var startTimePicker = advancedTemplate._pickers.startTime;
            startTimePicker.set_enabled(!allDay);

            var endTimePicker = advancedTemplate._pickers.endTime;
            endTimePicker.set_enabled(!allDay);
        };

        this._onAllDayCheckBoxClick = clickHandler;

        clickHandler(allDayCheckbox[0].checked, false);
        allDayCheckbox.click(function () { clickHandler(this.checked, true); });
    },

    _initializeResetExceptions: function () {
        var resetExceptions = $("#" + this._templateId + "_ResetExceptions");
        if (resetExceptions.length == 0)
            return;

        var scheduler = this._scheduler;
        var template = this;
        var localization = scheduler.get_localization();
        var doneMessage = localization.AdvancedDone;
        if (resetExceptions[0].innerHTML.indexOf(doneMessage) > -1) {
            // Hide "Done" after 2 seconds
            resetExceptions.click(function () { return false; });
            window.setTimeout(function () { resetExceptions.fadeOut("slow"); }, 2000);
        }
        else {
            resetExceptions.click(
                function () {
                    // Display confirmation dialog
                    var dialog = template._getRemoveExceptionsDialog();
                    dialog.set_onActionConfirm(function () {
                        // The user has confirmed - proceed with postback
                        resetExceptions[0].innerHTML = localization.AdvancedWorking;
                        window.location.href = resetExceptions[0].href;

                        dialog.dispose();
                    })
                        .show();

                    return false;
                });
        }
    },

    _getRemoveExceptionsDialog: function () {
        var localization = this._scheduler.get_localization();
        return $telerik.$.modal(this._formElement)
            .initialize()
            .set_content({
                title: localization.ConfirmResetExceptionsTitle,
                content: localization.ConfirmResetExceptionsText,
                ok: localization.ConfirmOK,
                cancel: localization.ConfirmCancel
            });
    },

    _updateValidator: function (validator) {
        var control = $("#" + validator.controltovalidate);

        if (control.is(".rsValidatedInput"))
            control = control.parent();

        if (!validator.isvalid)
            control.addClass("rsInvalid");
        else
            control.removeClass("rsInvalid");
    },

    _validatorIsInTemplate: function (validator) {
        return $(validator).parents().is("#" + this._schedulerElementId);
    },

    _createValidatorToolTip: function () {
        return $('<div></div>').hide().appendTo($('.rsAdvancedEdit:visible', $get(this._schedulerElementId)));
    },

    _showToolTip: function (e) {
        var toolTip = e.data.toolTip;
        var _control = $(this);
        var isTextArea = false;
        var controlParent = _control.parent();

        if (_control.is("textarea")) {
            isTextArea = true;
            _control = controlParent;
        }

        var isInvalid = _control.is(".rsInvalid");
        // Date and time pickers are validated against a hidden input located one level up in the DOM
        isInvalid = isInvalid || controlParent.parent().children().is(".rsInvalid");

        if (isInvalid) {
            toolTip
    .css("visibility", "hidden")
    .text(this.errorMessage)
    .addClass("rsValidatorTooltip");

            var positionOrigin = _control;
            if (controlParent.is(".riCell"))
                positionOrigin = controlParent;

            var pos = positionOrigin.position();
            var toolTipLeft = pos.left + "px";

            if (isTextArea) {
                toolTipLeft = (pos.left + positionOrigin.outerWidth() - toolTip.outerWidth()) + "px";
            }

            var toolTipTop = (pos.top - toolTip.outerHeight()) + "px";
            toolTip
    .css({
        top: toolTipTop,
        left: toolTipLeft,
        zIndex: toolTipZIndex,
        visibility: "visible"
    })
    .fadeIn("fast");
        }
    },

    _hideToolTip: function (e) {
        var toolTip = e.data.toolTip;
        toolTip.hide();
    },

    _hidePickerPopups: function () {
        if (!this._pickers)
            return;

        for (var pickerId in this._pickers) {
            var picker = this._pickers[pickerId];

            if (!picker)
                continue;

            if (picker.hideTimePopup)
                picker.hideTimePopup();
            else
                picker.hidePopup();
        }
    },

    _showPopup: function (sender) {
        this._hidePickerPopups();

        if (sender.Owner.showTimePopup)
            sender.Owner.showTimePopup();
        else
            sender.Owner.showPopup();
    }
};
        })();
    });

    var countriesCombo = null;
    function CountriesComboClientLoad(sender) {
        countriesCombo = sender;
    }
    function CountriesLoaded(combo, eventArqs) {
        if (combo.get_items().get_count() > 0) {
            // Pre-select the first country  
            combo.set_text(combo.get_items().getItem(0).get_text());
            combo.get_items().getItem(0).highlight();
        }
        combo.showDropDown();
    }

    function LoadCountries(combo, eventArqs) {
        var item = eventArqs.get_item();

        countriesCombo.set_text("Loading...");

        // Is continent selected?  
        if (item.get_index() > 0) {
            // Request items through the ItemsRequested event of the   
            // countries RadComboBox passing the continentID as a parameter   
            countriesCombo.requestItems(item.get_value(), false);

        }
        else {
            // The "-Select a continent-" item was chosen  
            countriesCombo.set_text(" ");
            countriesCombo.clearItems();
        }
    }

  

</script>
<%--<script type="text/javascript">   
//<![CDATA[

    function schedulerFormCreated(scheduler, eventArgs) {
        var $ = $telerik.$;
        var schedulerElement = scheduler.get_element();
        var formElement = $("div.rsAdvancedEdit", schedulerElement);

        if (formElement.length == 1) {
            // Initialize the client-side object for the advanced form  
            var advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement);
            advancedTemplate.initialize();
        }
    }  
 
//]]>   
</script> --%>

     <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
          <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                    <UpdatedControls>
                         <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
               </telerik:AjaxSetting>
          </AjaxSettings>
     </telerik:RadAjaxManager>
     <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />

    <table style="width: 100%" cellpadding="3" cellspacing="5" align="center">
        <tr>
            <td align="left" class="wepartFont">
                <telerik:RadScheduler runat="server" ID="RadScheduler1" OverflowBehavior="Expand"
                    Skin="Windows7" OnAppointmentDelete="RadScheduler1_AppointmentDelete" OnAppointmentUpdate="RadScheduler1_AppointmentUpdate"
                    OnAppointmentInsert="RadScheduler1_AppointmentInsert" SelectedView="MonthView"
                    OnFormCreated="RadScheduler1_FormCreated" DataStartField="Start" DataEndField="End"
                    AdvancedForm-Enabled="true" Localization-AdvancedNewAppointment="New Schedule"
                    StartInsertingInAdvancedForm="True" OnAppointmentCreated="RadScheduler1_AppointmentCreated"
                    OnFormCreating="RadScheduler1_FormCreating" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
                    StartEditingInAdvancedForm="true" OnClientFormCreated="schedulerFormCreated"
                    EnableCustomAttributeEditing="true"
                    CustomAttributeNames="Asset_Contact_Tag_ID,Shift_ID,Contact_ID"
                    >
                    <Localization AdvancedNewAppointment="New Schedule" AdvancedEditAppointment="Edit Schedule"
                        AdvancedSubjectRequired="Please provide schedule subject" ConfirmDeleteText="Are you sure you want to delete this schedule?"
                        ConfirmRecurrenceDeleteTitle="Deleting a recurring schedule" ConfirmRecurrenceEditTitle="Editing a recurring schedule"
                        ConfirmRecurrenceMoveTitle="Moving a recurring schedule" ConfirmRecurrenceResizeTitle="Resizing a recurring schedule"
                        ContextMenuAddAppointment="New Schedule" ContextMenuAddRecurringAppointment="New Recurring Schedule">
                    </Localization>
                    <AppointmentContextMenuSettings EnableDefault="true" />
                    <TimeSlotContextMenuSettings EnableDefault="true" />
                    <ExportSettings OpenInNewWindow="True">
                    </ExportSettings>
                    <AdvancedForm Modal="true" EnableTimeZonesEditing="true" />
                    <Reminders Enabled="true" />
                    <AdvancedEditTemplate>
                        <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
                            Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'
                            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Reminder='<%# Bind("Reminder") %>'
                            TimeZoneID='<%# Bind("TimeZoneID") %>'  />
                        />
                    </AdvancedEditTemplate>
                    <AdvancedInsertTemplate>
                        <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
                            Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>'
                            RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' Reminder='<%# Bind("Reminder") %>'
                            TimeZoneID='<%# Bind("TimeZoneID") %>'  />
                        />
                    </AdvancedInsertTemplate>
                </telerik:RadScheduler>
            </td>
        </tr>
    </table>

 

 

b) WPScedulerSharepointWebpartUserControl.ascx.cs

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Telerik.Web.UI;
using System.Data;
using System.Collections.Generic;
using OnCallSolution.ControlTemplates.OnCallSolution;
using System.ComponentModel;
using Microsoft.SharePoint.WebPartPages;
using System.Xml.Serialization;//for accessing the public properties from the advanced form

namespace OnCallSolution.WPScedulerSharepointWebpart
{
    [ToolboxItemAttribute(false)]
    [XmlRoot(Namespace = "OnCallSolution.WPScedulerSharepointWebpart")]
    public partial class WPScedulerSharepointWebpartUserControl : UserControl
    {
        // Fields
        protected RadScheduler RadScheduler1;
        public DataTable dtResult;
        UserInfoManupulator ui = new UserInfoManupulator();
              

        public virtual Object RecurrenceParentID
        {
            get;
            set;
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            RadScheduler1.Localization.AdvancedNewAppointment = "New Schedule";
            RadScheduler1.AdvancedForm.Enabled = true;
            RadScheduler1.SelectedDate = System.DateTime.UtcNow.ToLocalTime(); //this date is called as per UTC time line
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                this.LoadSchedulerData();
                //// this.LoadContactPerson();

                //// Session.Remove(AppointmentsKey);
                //RadScheduler1.DataKeyField = "ID";
                //RadScheduler1.DataStartField = "Start";
                //RadScheduler1.DataEndField = "End";
                //RadScheduler1.DataSubjectField = "Subject";
                //RadScheduler1.DataRecurrenceField = "RecurrenceRule";
                //RadScheduler1.DataRecurrenceParentKeyField = "RecurrenceParentID";
            }

            RadScheduler1.DataSource = Appointments;

        }
        // Methods
        private void LoadSchedulerData()
        {
            try
            {
                OC_Scheduler_Appointment sc = new OC_Scheduler_Appointment();
                DataTable dt = new DataTable();
                dt = null;
                dt = sc.getData();

                RadScheduler1.DataSource = dt;
                RadScheduler1.DataSubjectField = "Subject";
                RadScheduler1.DataStartField = "Start";
                RadScheduler1.DataEndField = "End";
                RadScheduler1.DataKeyField = "ID";
                RadScheduler1.DataRecurrenceField = "RecurrenceRule";
                RadScheduler1.DataRecurrenceParentKeyField = "RecurrenceParentID";
                RadScheduler1.DataBind();

            }
            catch (Exception ex)
            {
            }
        }

        private void LoadContactPerson()
        {
            try
            {

                OC_Scheduler_Appointment app = new OC_Scheduler_Appointment();
                dtResult = app.getContactforCalendar();
                if (dtResult != null)
                {
                    ResourceType rt = new ResourceType("Contact");
                    rt.ForeignKeyField = "Contact_ID";
                    rt.KeyField = "Contact_ID";
                    rt.TextField = "Name";
                    rt.DataSource = dtResult;

                    for (int i = 0; i < dtResult.Rows.Count; i++)
                    {
                        RadScheduler1.Resources.Add(new Resource("Contact", dtResult.Rows[i]["Contact_ID"].ToString(), dtResult.Rows[i]["Name"].ToString()));
                    }
                    RadScheduler1.ResourceTypes.Add(rt);
                }
            }
            catch (Exception ex)
            {
            }
        }

        private void LoadAssociatedTag()
        {
            // throw new NotImplementedException();
        }

        protected void RadScheduler1_AppointmentDelete(object sender, SchedulerCancelEventArgs e)
        {
            OC_Scheduler_Appointment appointmentDelete = new OC_Scheduler_Appointment();

            try
            {
                appointmentDelete.deleteAppointmentByID((int)e.Appointment.ID);
                LoadSchedulerData();
            }
            catch (Exception ex)
            {
            }
            LoadSchedulerData();
        }

        protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
        {
            #region CommentedCode

            //OC_Scheduler_Appointment appointmentAdd = new OC_Scheduler_Appointment();
            //AdvancedForm o = new AdvancedForm();//for accesing the public proerties from the advanced from

            //try
            //{

           
            //    appointmentAdd.Subject = e.Appointment.Subject.ToString();
            //    appointmentAdd.Start = e.Appointment.Start;
            //    appointmentAdd.End = e.Appointment.End;
            //    appointmentAdd.Description = e.Appointment.Description;// e.Appointment.Description;
            //    appointmentAdd.RecurrenceRule = e.Appointment.RecurrenceRule;// e.Appointment.RecurrenceRule.ToString();
            //    appointmentAdd.TimeZone = o.TimeZoneID;// e.Appointment.TimeZoneID;// .Appointment.TimeZoneID;
            //    appointmentAdd.Asset_Contact_Tag_ID = o.Asset_Contact_Tag_ID;// Asset_Contact_Tag_ID;// ContactID;// o._ContactIDofPerson;
            //    appointmentAdd.Shift_ID = 1;//temporary hard coaded values here 1 or 2
            //    appointmentAdd.Reminder = e.Appointment.Reminders.ToString();// e.Appointment.Reminders.ToString();
            //    appointmentAdd.Annotations = "";
            //    appointmentAdd.Updated_By = ui.GetCurrentUserLoginName();
            //    appointmentAdd.Update_Time = System.DateTime.UtcNow;

            //    DataTable dt = null;
            //    dt = appointmentAdd.getAsset_Contact_Tag_ID(o._Asset_Contact_Tag_ID, o._ContactID);

            //    if (dt != null)
            //    {
            //        appointmentAdd.Asset_Contact_Tag_ID = Convert.ToInt32(dt.Rows[0]["Asset_Contact_Tag_ID"]);
            //    }

            //    dt = null;

            //    dt = appointmentAdd.get_Shift_ID(appointmentAdd.Shift_ID);

            //    if (dt != null)
            //    {
            //        appointmentAdd.Shift_ID = Convert.ToInt32(dt.Rows[0]["Shift_ID"]);
            //    }

            //    //if Recurrent not done then RecurrenceParentID is 0 so send  value null to the database
            //    if (appointmentAdd.RecurrenceParentID == 0)
            //    {
            //        //Insert all values along with the recurentceParentID NULL if not recurrence done
            //        //int? tempRPID = sys.null;
            //        //appointmentAdd.RecurrenceParentID = tempRPID;
            //        int saveOrNot = appointmentAdd.saveApointmentDataWithRecureenceParentIDNull(appointmentAdd);
            //    }
            //    else
            //    {

            //        //Insert all values along with the recurentceParentID
            //        // appointmentAdd.RecurrenceParentID = (int?)RecurrenceParentID;
            //        int saveOrNot = appointmentAdd.saveApointmentData(appointmentAdd);

            //    }

 

            //}
            //catch (Exception ex)
            //{
            //}

            #endregion
            RadScheduler1.Rebind();
            // LoadSchedulerData();
            string wer = e.Appointment.Attributes["Continent"];

                      
        }
       
        protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
        {
           
            //OC_Scheduler_Appointment appointmentUpdate = new OC_Scheduler_Appointment();

            //try
            //{
            //    RecurrenceRule rrule;
            //    if (RecurrenceRule.TryParse(e.ModifiedAppointment.RecurrenceRule, out rrule))
            //    {
            //        rrule.Range.Start = e.ModifiedAppointment.Start;
            //        rrule.Range.EventDuration = e.ModifiedAppointment.End - e.ModifiedAppointment.Start;
            //        TimeSpan startTimeChange = e.ModifiedAppointment.Start - e.Appointment.Start;
            //        for (int i = 0; i < rrule.Exceptions.Count; i++)
            //        {
            //            rrule.Exceptions[i] = rrule.Exceptions[i].Add(startTimeChange);
            //        }

            //        e.ModifiedAppointment.RecurrenceRule = rrule.ToString();
            //    }

            //    appointmentUpdate.Subject = e.ModifiedAppointment.Subject.ToString();
            //    appointmentUpdate.Start = e.ModifiedAppointment.Start;
            //    appointmentUpdate.End = e.ModifiedAppointment.End;
            //    appointmentUpdate.Description =  e.ModifiedAppointment.Description;
            //   // appointmentUpdate.RecurrenceRule = e.ModifiedAppointment.RecurrenceRule;// RecurrenceRuleText;// e.Appointment.RecurrenceRule.ToString();
            //    appointmentUpdate.TimeZone = e.ModifiedAppointment.TimeZoneID; // .Appointment.TimeZoneID;
            //    //appointmentUpdate.Asset_Contact_Tag_ID = Asset_Contact_Tag_ID;// ContactID;// o._ContactIDofPerson;
            //    //appointmentUpdate.Shift_ID = 1;//temporary hard coaded values here 1 or 2
            //    //appointmentUpdate.Reminder = Reminder;// e.Appointment.Reminders.ToString();
            //    //appointmentUpdate.Annotations = "";
            //    //appointmentUpdate.Updated_By = ui.GetCurrentUserLoginName();
            //    //appointmentUpdate.Update_Time = System.DateTime.UtcNow;

            //    //DataTable dt = null;
            //    //dt = appointmentUpdate.getAsset_Contact_Tag_ID(Asset_Contact_Tag_ID, ContactID);

            //    //if (dt != null)
            //    //{
            //    //    appointmentUpdate.Asset_Contact_Tag_ID = Convert.ToInt32(dt.Rows[0]["Asset_Contact_Tag_ID"]);
            //    //}

            //    //dt = null;

            //    //dt = appointmentUpdate.get_Shift_ID(appointmentAdd.Shift_ID);

            //    //if (dt != null)
            //    //{
            //    //    appointmentUpdate.Shift_ID = Convert.ToInt32(dt.Rows[0]["Shift_ID"]);
            //    //}

            //    ////if Recurrent not done then RecurrenceParentID is 0 so send  value null to the database
            //    //if (appointmentUpdate.RecurrenceParentID == 0)
            //    //{
            //    //    //Insert all values along with the recurentceParentID NULL if not recurrence done
            //    //    //int? tempRPID = sys.null;
            //    //    //appointmentAdd.RecurrenceParentID = tempRPID;
            //    //    int saveOrNot = appointmentUpdate.saveApointmentDataWithRecureenceParentIDNull(appointmentAdd);
            //    //}
            //    //else
            //    //{

            //    //    //Insert all values along with the recurentceParentID
            //    //    // appointmentAdd.RecurrenceParentID = (int?)RecurrenceParentID;
            //    //    int saveOrNot = appointmentUpdate.saveApointmentData(appointmentAdd);

            //    //    //get latest insterted record
            //    //    //SELECT ID FROM Appointments WHERE id=(SELECT max(id) FROM Appointments)

 

            //    //}

 

            //}
            //catch (Exception ex)
            //{
            //}

 

 

            //RecurrenceRule rrule;
            //if (RecurrenceRule.TryParse(e.ModifiedAppointment.RecurrenceRule, out rrule))
            //{
            //    rrule.Range.Start = e.ModifiedAppointment.Start;
            //    rrule.Range.EventDuration = e.ModifiedAppointment.End - e.ModifiedAppointment.Start;
            //    TimeSpan startTimeChange = e.ModifiedAppointment.Start - e.Appointment.Start;
            //    for (int i = 0; i < rrule.Exceptions.Count; i++)
            //    {
            //        rrule.Exceptions[i] = rrule.Exceptions[i].Add(startTimeChange);
            //    }

            //    e.ModifiedAppointment.RecurrenceRule = rrule.ToString();
            //    e.ModifiedAppointment.Subject=

            //}

            LoadSchedulerData();
        }

        protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
            if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
            {
               
                if (e.Appointment.ID != null)//if this numm then new appoinement inserting and if its has value then Edit Appoitment will work aarangement done here
                {

                    ////Start this part will store the appointment ID in hiddent text fields which I will required to update the data from Advanced form
                    //RadTextBox txtGetAppHiddentID = (RadTextBox)e.Container.Controls[1].Controls[1].FindControl("RadTextHiddenAppID");
                    //txtGetAppHiddentID.Text = e.Appointment.ID.ToString();
                    //_AppID = Convert.ToInt32(e.Appointment.ID);
                    ////end

                    //get Asset_Contact_Tag_ID by Appoitment ment ID from the Edit appointment
                    // getAsset_Contact_Tag_IDByAppointmentID (Method)

                    OC_Scheduler_Appointment getAsset_Contact_Tag = new OC_Scheduler_Appointment();
                    dtResult = getAsset_Contact_Tag.getAsset_Contact_Tag_IDByAppointmentID((int)e.Appointment.ID);

                    int assetID = Convert.ToInt32(dtResult.Rows[0]["Asset_Contact_Tag_ID"]);

                    //Select person and tag on Edit the existing appointment
                    //get people
                    //Select distinct Contact_ID, Name from OC_Contact where Contact_ID=(Select Contact_ID from OC_Asset_Contact_Tag where Asset_Contact_Tag_ID=151)

                    OC_Scheduler_Appointment getPersonAndContactID = new OC_Scheduler_Appointment();

                    RadComboBox rcb_PersonName = (RadComboBox)e.Container.Controls[1].Controls[1].FindControl("ContinentsRadComboBox");

                    dtResult = getPersonAndContactID.getPersonNameForFirstComboBoxInEditAppointment();
                    //rcb_PersonName.ClearSelection();
                    //rcb_PersonName.DataSource = dtResult;
                    //rcb_PersonName.DataTextField = "Name";
                    //rcb_PersonName.DataValueField = "Contact_ID";
                    //rcb_PersonName.DataBind();

                    dtResult = getPersonAndContactID.getPersonAndContactIDOnEditAppointmentByAsset_Contact_Tag_ID(assetID);
                    int contactid = Convert.ToInt32(dtResult.Rows[0]["Contact_ID"]);

                    rcb_PersonName.SelectedItem.Text = dtResult.Rows[0]["Name"].ToString();
                    string compare = dtResult.Rows[0]["Name"].ToString();

                    //for Selected the person name whille in Edit appointment mode
                    if (compare == dtResult.Rows[0]["Name"].ToString())
                    {
                        rcb_PersonName.SelectedItem.Text = dtResult.Rows[0]["Name"].ToString();
                    }

                    dtResult = getPersonAndContactID.getTagNameByPersonNameOnEditAppointment(rcb_PersonName.SelectedItem.Text);
                    RadComboBox rcb_Tag = (RadComboBox)e.Container.Controls[1].Controls[1].FindControl("CountriesRadComboBox");
                    rcb_Tag.DataSource = dtResult;
                    rcb_Tag.DataTextField = "Tag_Name";
                    rcb_Tag.DataValueField = "Asset_Tags_Master_ID";
                    rcb_Tag.DataBind();
                    rcb_Tag.SelectedItem.Text = dtResult.Rows[0]["Tag_Name"].ToString();

 

                    // Select distinct T.Asset_Tags_Master_ID,t.Tag_Name  from OC_Asset_Contact_Tag CT inner join  OC_Asset_Tag_Master T  on t.Asset_Tags_Master_ID=ct.Asset_Tags_Master_ID inner join OC_Contact C on c.Contact_ID=  ct.Contact_ID where C.Name='Penkar, Shafaque' and ct.Status=1

 

                    // int currentValueOfPersonAfterRuntimeSelectedPersonName = Convert.ToInt32(rcb_PersonName.SelectedValue);

                    //create run time selected index before filling data of tags name as its should be populated before personame dropdown . So runtime we are selecting index of first dropdown and then willselect text from the below methods
                    // rcb_PersonName.SelectedItem.Text = Convert.ToInt32(dtResult.Rows[0]["Contact_ID"]);

                    //get Tag
                    //select Asset_Tags_Master_ID,Tag_Name from  OC_Asset_Tag_Master where Asset_Tags_Master_ID =(select Asset_Tags_Master_ID from OC_Asset_Contact_Tag where Contact_ID=13 and Asset_Contact_Tag_ID=138) 

 

 

                    ////select TagName on edit of existing appointment and get id's from above function
                    //OC_Scheduler_Appointment getTagNameAndTagID = new OC_Scheduler_Appointment();
                    //dtResult = getTagNameAndTagID.getTagNameAndAsset_Contact_Tag_IDOnEditAppointmentByContactIDAndAppointmentID(contactid, assetID);
                    //RadComboBox rcb_Tag = (RadComboBox)e.Container.Controls[1].Controls[1].FindControl("CountriesRadComboBox");
                    ////rcb_Tag.SelectedIndex = Convert.ToInt32(dtResult.Rows[0]["Asset_Tags_Master_ID"]);
                    //rcb_Tag.SelectedItem.Text = dtResult.Rows[0]["Tag_Name"].ToString();

 

                }
                else
                {
                    //for validation of person and Tag name combobox
                    //RadComboBox rcb_PersonName = (RadComboBox)e.Container.Controls[1].Controls[1].FindControl("ContinentsRadComboBox");
                    //RequiredFieldValidator rfv= new RequiredFieldValidator();
                    //rfv.ID="rcb_PersonName";
                    //rfv.ControlToValidate="";
                    //rfv.ErrorMessage="*";
                    //rfv.CssClass="errormesg";
                    //rfv.Display=ValidatorDisplay.Dynamic;

                    //if (rcb_PersonName.SelectedIndex==-1)
                    //{

                    //}
                    //else
                    //{

                    //}

 

                    //RadComboBox rcb_Tag = (RadComboBox)e.Container.Controls[1].Controls[1].FindControl("CountriesRadComboBox");

                                                      

                  
                }
            }
        }

        void rcb_PersonName_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            //throw new NotImplementedException();
            AdvancedForm ad = new AdvancedForm();
            ad.LoadCountries(e.Text);
        }

        void rcb_PersonName_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            //throw new NotImplementedException();

            // DropDownList ddl1 = (DropDownList)sender;
            //  Label1.Text += ddl1.SelectedItem.Text + " ";

            // RadComboBox rcbSelectedRunTime = (RadComboBox)sender;

            AdvancedForm ad = new AdvancedForm();
            ad.LoadCountries(e.Text);
        }

        class AppointmentInfo
        {
            private string id;
            private string subject;
            private DateTime start;
            private DateTime end;
            private string recurParentID;
            private string recurData;
            private int contact_id;

            public string ID
            {
                get { return id; }
                set { id = value; }
            }
            public string Subject
            {
                get { return subject; }
                set { subject = value; }
            }
            public DateTime Start
            {
                get { return start; }
                set { start = value; }
            }
            public DateTime End
            {
                get { return end; }
                set { end = value; }
            }
            public string RecurrenceRule
            {
                get { return recurData; }
                set { recurData = value; }
            }
            public string RecurrenceParentID
            {
                get { return recurParentID; }
                set { recurParentID = value; }
            }
            public int Contact_ID
            {
                get { return contact_id; }
                set { contact_id = value; }
            }
            private AppointmentInfo()
            {
                this.id = Guid.NewGuid().ToString();
            }
            public AppointmentInfo(string subject, DateTime start, DateTime end)
                : this()
            {
                this.subject = subject;
                this.start = start;
                this.end = end;
            }
            public AppointmentInfo(Appointment source)
                : this()
            {
                CopyInfo(source);
            }
            public void CopyInfo(Appointment source)
            {
                subject = source.Subject;
                start = source.Start;
                end = source.End;
                recurData = source.RecurrenceRule;
                if (source.RecurrenceParentID != null)
                    recurParentID = source.RecurrenceParentID.ToString();
                Resource r = source.Resources.GetResourceByType("ContactInfoHere");
                if (r != null)
                    contact_id = (int)r.Key;
            }
        }
        class ContactInfo
        {
            private int id;
            private string name;

            public int Contact_ID
            {
                get { return id; }
            }
            public string Name
            {
                get { return name; }
            }
            public ContactInfo(int id, string name)
            {
                this.id = id;
                this.name = name;
            }
        }

        private List<AppointmentInfo> Appointments
        {
            get
            {
                List<AppointmentInfo> sessApts = Session["sdfsdfsdf"] as List<AppointmentInfo>;
                //          Session[AppointmentsKey] as List<AppointmentInfo>;
                //if (sessApts == null)
                //{
                //    sessApts = new List<AppointmentInfo>();
                //    Session[AppointmentsKey] = sessApts;
                //}
                return sessApts;
            }
        }
        private List<ContactInfo> contact
        {
            get
            {
                List<ContactInfo> roomList = new List<ContactInfo>();
                roomList.Add(new ContactInfo(1, "Margaret Morrison Main Room"));
                roomList.Add(new ContactInfo(2, "Black Auditorium"));
                roomList.Add(new ContactInfo(3, "Doherty Auditorium"));
                return roomList;
            }
        }

        protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
        {
            //while appointment creating check wether its valid to save or not time span matching or now
        }

        protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
        {
            //Check what to to do on when appoiment ment created ///Like enable disable Subject panel
        }

        protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
        {

        }
    }
}

 

c) AdvanceForm.ascx
 <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AdvancedForm.ascx.cs" Inherits="OnCallSolution.ControlTemplates.OnCallSolution.AdvancedForm" %>

<%@ Register Assembly="Telerik.Web.UI, Version=2013.1.403.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<link rel="Stylesheet" type="text/css" href="/_layouts/OnCallSolution/StyleOnCall.css" />

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
<script language="javascript" type="text/javascript">
    Sys.Application.add_init(function () {
        (function () {

            var $,
     $T,
     $DateTime,
     timePerMinute = 60000,
     timePerHour = timePerMinute * 60,
     timePerDay = timePerHour * 24,
     maxInt = 2147483647,
     maxDate = new Date("9000/01/01"),
     toolTipZIndex = 10000,
     resourceControlSuffix = "_ResourceValue";

            window.SchedulerAdvancedTemplate = function (schedulerElement, formElement, isModal) {
                $ = $telerik.$;
                $T = Telerik.Web.UI;
                $DateTime = $T.Scheduler.DateTime;

                this._scheduler = $find(schedulerElement.id);
                this._schedulerElement = schedulerElement;
                this._formElement = formElement;
                this._schedulerElementId = this._schedulerElement.id;
                this._isModal = isModal;
                this._eventNamespace = schedulerElement.id;

                // We need to obtain the ID of the naming container that
                // contains the advanced template. We can find it from
                // the ID of a known element hosted in the form,
                // such as BasicControlsPanel.
                var basicControlsPanel = $("div.rsAdvBasicControls", formElement);
                if (basicControlsPanel.length == 0)
                    return;

                var basicControlsPanelId = basicControlsPanel[0].id;
                this._templateId = basicControlsPanelId.substring(0, basicControlsPanelId.lastIndexOf("_"));
            };

            window.SchedulerAdvancedTemplate._adjustHeight = function (schedulerElement) {
                // Stretches the rsAdvOptions div to the available height.
                var advancedEditDiv = $("div.rsAdvancedEdit:visible", schedulerElement);
                var contentWrapper = $(".rsAdvContentWrapper", advancedEditDiv);
                var excludedBorders = advancedEditDiv.outerHeight() - advancedEditDiv.height();
                excludedBorders += contentWrapper.outerHeight() - contentWrapper.height();

                var titleHeight = $("div.rsAdvTitle:visible", schedulerElement).outerHeight({ margin: true });

                var buttonsDiv = $("div.rsAdvancedSubmitArea", advancedEditDiv);
                var buttonsHeight = buttonsDiv.outerHeight({ margin: true });

                var targetHeight = $(schedulerElement).height() - titleHeight - buttonsHeight - excludedBorders;
                $(".rsAdvOptionsScroll", advancedEditDiv).height(targetHeight + "px");

                // IE fix
                if (buttonsDiv[0])
                    buttonsDiv[0].style.cssText = buttonsDiv[0].style.cssText;
            };

            window.SchedulerAdvancedTemplate.prototype =
{
    initialize: function () {
        var scheduler = this._scheduler;
        scheduler.add_disposing(Function.createDelegate(this, this.dispose));

        // Enable the buttons in the advanced form
        $("div.rsAdvancedSubmitArea a", this._formElement).attr("onclick", "");

        if (scheduler.get_overflowBehavior() == 1 && !this._isModal)
            window.SchedulerAdvancedTemplate._adjustHeight(this._schedulerElement);

        this._initializePickers();
        this._initializeAdvancedFormValidators();
        this._initializeAllDayCheckbox();

        var recurrenceSupport = this._getRecurrenceEditor() != null;
        if (recurrenceSupport) {
            this._initializeResetExceptions();
        }

        if ($telerik.isIE) {
            var textarea = this._getSubjectTextBox().get_element();
            textarea.style.cssText = textarea.style.cssText;
        }

        // Exclude the spin button arrows from the tab order
        $('.riUp, .riDown', this._formElement).attr("tabindex", "-1");
    },

    dispose: function () {
        if (!this._formElement)
            return;

        $("*", this._formElement).unbind();
        $(document).unbind("." + this._eventNamespace);

        this._pickers = null;
        this._scheduler = null;
        this._schedulerElement = null;
        this._formElement = null;
    },

    // The populate function is needed only when using Web Service data binding.
    populate: function (apt, isInsert) {
        if (!this._clientMode)
            this._initializeClientMode();

        this._appointment = apt;
        this._isInsert = isInsert;

        var isAllDay =
            $DateTime.getTimeOfDay(apt.get_start()) == 0 &&
            $DateTime.getTimeOfDay(apt.get_end()) == 0;

        var aptEndDate = $DateTime.getDate(apt.get_end());
        if (isAllDay)
            aptEndDate = $DateTime.add(aptEndDate, -timePerDay);

        this._getSubjectTextBox().set_value(apt.get_subject());

        var descrTextBox = this._getDescriptionTextBox();
        if (descrTextBox)
            descrTextBox.set_value(apt.get_description());

        this._pickers.startDate.set_selectedDate($DateTime.getDate(apt.get_start()));
        this._pickers.startTime.set_selectedDate(apt.get_start());
        this._pickers.endDate.set_selectedDate(aptEndDate);
        this._pickers.endTime.set_selectedDate(apt.get_end());

        this._populateResources();
        this._populateAttributes();

        this._initalizeResetExceptionsClientMode();

        var allDayCheckBox = $("#" + this._templateId + "_AllDayEvent");
        if (isAllDay != allDayCheckBox[0].checked) {
            allDayCheckBox[0].checked = isAllDay;
            this._onAllDayCheckBoxClick(isAllDay, false);
        }

        this._populateRecurrence();
        this._populateReminder();
        this._populateTimeZones();
    },

    _initializeClientMode: function () {
        this._clientMode = true;
        var template = this;

        $("a.rsAdvEditSave", this._formElement)
            .click(function (e) {
                template._saveClicked();
                $telerik.cancelRawEvent(e);
            })
            .attr("href", "#");

        $("a.rsAdvEditCancel, a.rsAdvEditClose", this._formElement)
            .click(function (e) {
                template._cancelClicked();
                $telerik.cancelRawEvent(e);
            })
            .attr("href", "#");
    },

    _initalizeResetExceptionsClientMode: function () {
        var resetExceptions = $("span.rsAdvResetExceptions > a", this._formElement);
        var hasExceptions = this._appointment.get_recurrenceRule().indexOf("EXDATE") != -1;

        resetExceptions.unbind();

        if (hasExceptions) {
            var template = this;
            var localization = this._scheduler.get_localization();
            resetExceptions
                .attr("href", "#")
                .text(localization.AdvancedReset)
                .click(function () {
                    // Display confirmation dialog
                    template._getRemoveExceptionsDialog()
                        .set_onActionConfirm(function () {
                            // The user has confirmed - proceed
                            template._scheduler.removeRecurrenceExceptions(template._appointment);
                            resetExceptions.text(localization.AdvancedDone);
                        })
                        .show();

                    return false;
                });
        }
        else {
            resetExceptions.text("");
        }
    },

    // Click handler for the "Save" button
    _saveClicked: function () {
        if (typeof (Page_ClientValidate) != "undefined") {
            var validationGroup = this._scheduler.get_validationGroup() + (this._isInsert ? "Insert" : "Edit");
            if (!Page_ClientValidate(validationGroup))
                return;
        }

        var apt = this._appointment;
        apt.set_subject(this._getSubjectTextBox().get_value());

        var descrTextBox = this._getDescriptionTextBox();
        if (descrTextBox)
            apt.set_description(descrTextBox.get_value());

        var isAllDay = $get(this._templateId + "_AllDayEvent").checked;

        var startDate = this._pickers.startDate.get_selectedDate();
        var startTime = $DateTime.getTimeOfDay(this._pickers.startTime.get_selectedDate());
        apt.set_start($DateTime.add(startDate, isAllDay ? 0 : startTime));

        var endDate = this._pickers.endDate.get_selectedDate();
        var endTime = $DateTime.getTimeOfDay(this._pickers.endTime.get_selectedDate());
        apt.set_end($DateTime.add(endDate, isAllDay ? timePerDay : endTime));

        this._saveResources(apt);
        this._saveAttributes(apt);

        this._saveRecurrenceRule(apt);
        this._saveReminder(apt);
        this._saveTimeZone(apt);

        if (this._isInsert)
            this._scheduler.insertAppointment(apt);
        else
            this._scheduler.updateAppointment(apt);

        this._scheduler.hideAdvancedForm();
    },

    _cancelClicked: function () {
        this._scheduler.hideAdvancedForm();
    },

    _saveResources: function (apt) {
        var template = this;
        var schedulerResources = this._scheduler.get_resources();

        this._scheduler.get_resourceTypes().forEach(function (resourceType) {
            var resourceTypeName = resourceType.get_name();
            var baseName = template._templateId + "_Res" + resourceTypeName + resourceControlSuffix;
            var resourcesOfThisType = schedulerResources.getResourcesByType(resourceTypeName);

            if (resourceType.get_allowMultipleValues()) {
                var checkBoxes = $(String.format("input[id*='{0}']", baseName), this._formElement);

                if (checkBoxes.length > 0)
                    apt.get_resources().removeResourcesByType(resourceTypeName);

                for (var i = 0; i < checkBoxes.length; i++) {
                    if (checkBoxes[i].checked && resourcesOfThisType.get_count() >= i)
                        apt.get_resources().add(resourcesOfThisType.getResource(i));
                };
            }
            else {
                var dropDown = $find(baseName);
                if (!dropDown)
                    return;

                apt.get_resources().removeResourcesByType(resourceTypeName);

                if (dropDown.get_selectedIndex() == 0)
                    return;

                var selectedValue = dropDown.get_selectedItem().get_value();
                var newResource = schedulerResources.findAll(function (res) {
                    return res.get_type() == resourceTypeName &&
                           res._getInternalKey() == selectedValue;
                }).getResource(0) || null;

                if (newResource)
                    apt.get_resources().add(newResource);
            }
        });
    },

    _saveAttributes: function (apt) {
        var template = this;
        var aptAttributes = apt.get_attributes();
        $.each(this._scheduler.get_customAttributeNames(), function () {
            var attrName = this.toString();
            var textBox = $find(template._templateId + "_Attr" + attrName);
            if (!textBox)
                return;

            aptAttributes.removeAttribute(attrName);
            aptAttributes.setAttribute(attrName, textBox.get_value());
        });
    },

    _getResourceIndex: function (res) {
        var resources = this._scheduler.get_resources().getResourcesByType(res.get_type());
        var index, length;

        for (index = 0, length = resources.get_count(); index < length; index++) {
            var filteredRes = resources.getResource(index);
            if (filteredRes.get_type() == res.get_type() && filteredRes.get_key() == res.get_key())
                return index;
        };

        return -1;
    },

    _populateResources: function () {
        var template = this;
        var resourceTypes = this._scheduler.get_resourceTypes();

        resourceTypes.forEach(function (resType) {
            var baseName = template._templateId + "_Res" + resType.get_name() + resourceControlSuffix;

            if (resType.get_allowMultipleValues()) {
                // Clear the resource checkboxes
                $(String.format("input[id*='{0}']", baseName), this._formElement)
                    .each(function () {
                        this.checked = false;
                    });
            }
            else {
                var dropDown = $find(baseName);
                if (dropDown)
                    dropDown.get_items().getItem(0).select();
            }
        });

        this._appointment.get_resources().forEach(function (res) {
            var baseName = template._templateId + "_Res" + res.get_type() + resourceControlSuffix;
            var resType = resourceTypes.getResourceTypeByName(res.get_type());
            if (resType && resType.get_allowMultipleValues()) {
                var resIndex = template._getResourceIndex(res);
                var checkBox = $get(baseName + "_" + resIndex);

                if (checkBox)
                    checkBox.checked = true;
            }
            else {
                var dropDown = $get(baseName);
                if (dropDown)
                    template._selectDropDownValue(dropDown, res._getInternalKey());
            }
        });
    },

    _populateAttributes: function () {
        var template = this;
        this._appointment.get_attributes().forEach(function (attr, attrValue) {
            var textBox = $find(template._templateId + "_Attr" + attr);
            if (!textBox)
                return;

            textBox.set_value(attrValue);
        });
    },

    _saveRecurrenceRule: function (apt) {
        var editor = this._getRecurrenceEditor();
        if (!editor) return;

        editor.set_startDate(this._scheduler.displayToUtc(apt.get_start()));
        editor.set_endDate(this._scheduler.displayToUtc(apt.get_end()));
        editor.set_firstDayOfWeek(this._scheduler.get_firstDayOfWeek());

        var rrule = editor.get_recurrenceRule();
        if (!rrule) {
            apt.set_recurrenceRule("");
            return;
        }

        // Restore the original recurrence exceptions if the
        // appointment was already recurring.
        var originalRRule = $T.RecurrenceRule.parse(apt.get_recurrenceRule());
        if (originalRRule)
            Array.addRange(rrule.get_exceptions(), originalRRule.get_exceptions());

        var range = rrule.get_range();
        if (range.get_recursUntil().getTime() != maxDate.getTime()) {
            var recursUntil = this._scheduler.displayToUtc(range.get_recursUntil());

            if (!this._getElement("AllDayEvent").checked)
                recursUntil = $DateTime.add(recursUntil, timePerDay);

            range.set_recursUntil(recursUntil);
        }

        apt.set_recurrenceRule(rrule.toString());
    },

    _saveTimeZone: function (apt) {
        var timeZonesDropDown = this._getTimeZonesDropDown();
        if (!timeZonesDropDown) return;

        var selectedValue = timeZonesDropDown.get_value();
        if (selectedValue != this._scheduler._timeZoneID)
            apt.set_timeZoneID(selectedValue);

    },

    _saveReminder: function (apt) {
        var reminderDropDown = this._getReminderDropDown();
        if (!reminderDropDown) return;

        var selectedValue = reminderDropDown.get_value();
        var aptReminders = apt.get_reminders();
        if (selectedValue) {
            var reminderMinutes = parseInt(selectedValue, 10);
            if (aptReminders.get_count() > 0) {
                aptReminders.getReminder(0).set_trigger(reminderMinutes);
            }
            else {
                var reminder = new $T.Reminder();
                reminder.set_trigger(reminderMinutes);
                aptReminders.add(reminder);
            }
        }
        else {
            if (aptReminders.get_count() > 0)
                aptReminders.removeAt(0);
        }
    },

    _populateRecurrence: function () {
        var editor = this._getRecurrenceEditor();
        if (!editor) return;

        var rrule = $T.RecurrenceRule.parse(this._appointment.get_recurrenceRule());
        if (rrule) {
            var range = rrule.get_range();
            var recursUntil = range.get_recursUntil().getTime();
            if (recursUntil != maxDate.getTime()) {
                recursUntil = this._scheduler.utcToDisplay(range.get_recursUntil());

                if (!this._getElement("AllDayEvent").checked)
                    recursUntil = $DateTime.add(recursUntil, -timePerDay);

                range.set_recursUntil(recursUntil);
            }
        }
        else {
            editor.set_startDate(this._appointment.get_start());
            editor.set_endDate(this._appointment.get_end());
        }

        editor.set_recurrenceRule(rrule);
    },

    _populateTimeZones: function () {
        var timeZonesDropDown = this._getTimeZonesDropDown();
        if (!timeZonesDropDown) return;

        var timeZone = this._appointment.get_timeZoneID();
        if (!timeZone)
            this._selectDropDownValue(timeZonesDropDown.get_element(), this._scheduler._timeZoneId);
        else
            this._selectDropDownValue(timeZonesDropDown.get_element(), timeZone);
    },

    _populateReminder: function () {
        var reminderDropDown = this._getReminderDropDown();
        if (!reminderDropDown) return;

        var reminder = this._appointment.get_reminders().getReminder(0);
        if (!reminder)
            this._selectDropDownValue(reminderDropDown.get_element(), "");
        else
            this._selectDropDownValue(reminderDropDown.get_element(), reminder.get_trigger());
    },

    _selectDropDownValue: function (dropDown, value) {
        var comboBox = $find(dropDown.id);
        if (comboBox && $T.RadComboBox.isInstanceOfType(comboBox)) {
            comboBox.get_items().forEach(function (item) {
                if (item.get_value() == value)
                    item.select();
            });
        }
        else {
            $.each(dropDown.options, function () {
                if (this.value == value) {
                    this.selected = true;
                    return false;
                }
            });
        }
    },

    _getSubjectTextBox: function () {
        return $find(this._templateId + "_SubjectText");
    },

    _getDescriptionTextBox: function () {
        return $find(this._templateId + "_DescriptionText");
    },

    _getRecurrenceEditor: function () {
        return $find(this._templateId + "_AppointmentRecurrenceEditor");
    },

    _getReminderDropDown: function () {
        return this._getControl("ReminderDropDown")
    },

    _getTimeZonesDropDown: function () {
        return this._getControl("TimeZonesDropDown")
    },

    _getElement: function (id) {
        return $get(this._templateId + "_" + id);
    },

    _getControl: function (id) {
        return $find(this._templateId + "_" + id);
    },

    _initializePickers: function () {
        // Show picker pop-ups when the inputs are focused

        var showPopupDelegate = Function.createDelegate(this, this._showPopup);

        var templateId = this._templateId;
        this._pickers =
          {
              "startDate": $find(templateId + "_StartDate"),
              "endDate": $find(templateId + "_EndDate"),
              "startTime": $find(templateId + "_StartTime"),
              "endTime": $find(templateId + "_EndTime")
          };

        $.each(
               this._pickers,
               function () {
                   if (this && this.get_dateInput)
                       this.get_dateInput().add_focus(showPopupDelegate);
               });

        var pickerControls = [
                         $get(this._pickers.startDate.get_element().id + "_wrapper"),
                         $get(this._pickers.startTime.get_element().id + "_wrapper"),
                         $get(this._pickers.startTime.get_element().id + "_timeView_wrapper"),
                         $get(this._pickers.endDate.get_element().id + "_wrapper"),
                         $get(this._pickers.endTime.get_element().id + "_wrapper"),
                         $get(this._pickers.endTime.get_element().id + "_timeView_wrapper"),
                         $get(this._templateId + "_SharedCalendar")
                    ];

        // Hide the pickers when the focus moves to another element in the template
        var advancedTemplate = this;
        var eventName = "focusin";

        $(this._formElement).bind(eventName,
               function (e) {
                   var inPickerControls = false;
                   for (var i = 0, len = pickerControls.length; i < len; i++) {
                       var control = pickerControls[i];
                       if ($telerik.isDescendantOrSelf(control, e.target)) {
                           inPickerControls = true;
                           break;
                       }
                   }

                   if (!inPickerControls)
                       advancedTemplate._hidePickerPopups();
               });

        // Custom jQuery event fired when the pop-up advanced
        // form has been moved.
        $(this._formElement).bind("formMoving", function () {
            advancedTemplate._hidePickerPopups();
        });

        if (this._isModal)
            $(document).bind("scroll." + this._eventNamespace, function () {
                advancedTemplate._hidePickerPopups();
            });
    },

    _initializeAdvancedFormValidators: function () {
        var toolTip = this._createValidatorToolTip();

        if (typeof (Page_Validators) == "undefined")
            return;

        for (var validatorIndex in Page_Validators) {
            var validator = Page_Validators[validatorIndex];
            if (this._validatorIsInTemplate(validator)) {
                var control = $("#" + validator.controltovalidate);
                if (control.length == 0)
                    break;

                if (control.parent().is(".rsAdvDatePicker") ||
                         control.parent().is(".rsAdvTimePicker")) {
                    $("#" + validator.controltovalidate + "_dateInput")
                              .bind("focus", { "toolTip": toolTip }, this._showToolTip)
                              .bind("blur", { "toolTip": toolTip }, this._hideToolTip)
                              [0].errorMessage = validator.errormessage;
                }
                else {
                    control.addClass("rsValidatedInput");
                }

                control[0].errorMessage = validator.errormessage;
                this._updateValidator(validator, control);
            }
        }

        var advancedTemplate = this;
        var originalValidatorUpdateDisplay = ValidatorUpdateDisplay;

        ValidatorUpdateDisplay = function (validator) {
            if (advancedTemplate._validatorIsInTemplate(validator) && validator.controltovalidate) {
                advancedTemplate._updateValidator(validator);
            }
            else {
                originalValidatorUpdateDisplay(validator);
            }
        };

        $(".rsValidatedInput", this._formElement)
               .bind("focus", { "toolTip": toolTip }, this._showToolTip)
               .bind("blur", { "toolTip": toolTip }, this._hideToolTip);
    },

    _initializeAllDayCheckbox: function () {
        var allDayCheckbox = $("#" + this._templateId + "_AllDayEvent");
        var controlList = $(allDayCheckbox[0].parentNode.parentNode.parentNode);
        var timePickers = controlList.find('.rsAdvTimePicker');

        // RadDateTimePicker-display-hackedy-hack
        if ($telerik.isIE6 || $telerik.isIE7) {
            $('.rsAdvTimePicker, .rsAdvDatePicker', this._formElement).css(
               {
                   display: "inline",
                   zoom: 1,
                   width: ""
               });
        }
        else {
            $('.rsAdvTimePicker, .rsAdvDatePicker', this._formElement).css(
               {
                   display: "inline-block",
                   width: ""
               });
        }

        var timePickersWidth = $("#" + this._templateId + "_StartTime_dateInput").outerWidth();

        timePickers.width(timePickersWidth);

        var initialPickersWidth = $(".rsTimePick", this._formElement).eq(0).outerWidth();
        var allDayPickersWidth = initialPickersWidth - timePickersWidth;

        var startTimeValidator = $get(this._templateId + "_StartTimeValidator");
        var endTimeValidator = $get(this._templateId + "_StartTimeValidator");

        var advancedTemplate = this;

        // IE fix - the hidden input pushes down the other TimePicker elements during animation
        controlList.find('.rsAdvTimePicker > input').css("display", "none");

        var clickHandler = function (allDay, animate) {
            var showTimePickers = function () {
                if ($telerik.isSafari || $telerik.isOpera)
                    timePickers.css("display", "inline-block");
                else
                    timePickers.show();
            };

            if (!allDay)
                showTimePickers();

            controlList.find('.rsTimePick').each(function () {
                if (animate) {
                    $(this).stop();

                    if (allDay)
                        $(this).animate({ width: allDayPickersWidth }, "fast",
                                   "linear", function () { timePickers.hide(); });
                    else
                        $(this).animate({ width: initialPickersWidth }, "fast");
                }
                else {
                    if (allDay) {
                        timePickers.hide();
                        $(this).width(allDayPickersWidth);
                    }
                    else {
                        $(this).width(initialPickersWidth);
                    }
                }
            });

            if (typeof (ValidatorEnable) != "undefined") {
                ValidatorEnable(startTimeValidator, !allDay);
                ValidatorEnable(endTimeValidator, !allDay);
            }

            var startTimePicker = advancedTemplate._pickers.startTime;
            startTimePicker.set_enabled(!allDay);

            var endTimePicker = advancedTemplate._pickers.endTime;
            endTimePicker.set_enabled(!allDay);
        };

        this._onAllDayCheckBoxClick = clickHandler;

        clickHandler(allDayCheckbox[0].checked, false);
        allDayCheckbox.click(function () { clickHandler(this.checked, true); });
    },

    _initializeResetExceptions: function () {
        var resetExceptions = $("#" + this._templateId + "_ResetExceptions");
        if (resetExceptions.length == 0)
            return;

        var scheduler = this._scheduler;
        var template = this;
        var localization = scheduler.get_localization();
        var doneMessage = localization.AdvancedDone;
        if (resetExceptions[0].innerHTML.indexOf(doneMessage) > -1) {
            // Hide "Done" after 2 seconds
            resetExceptions.click(function () { return false; });
            window.setTimeout(function () { resetExceptions.fadeOut("slow"); }, 2000);
        }
        else {
            resetExceptions.click(
                function () {
                    // Display confirmation dialog
                    var dialog = template._getRemoveExceptionsDialog();
                    dialog.set_onActionConfirm(function () {
                        // The user has confirmed - proceed with postback
                        resetExceptions[0].innerHTML = localization.AdvancedWorking;
                        window.location.href = resetExceptions[0].href;

                        dialog.dispose();
                    })
                        .show();

                    return false;
                });
        }
    },

    _getRemoveExceptionsDialog: function () {
        var localization = this._scheduler.get_localization();
        return $telerik.$.modal(this._formElement)
            .initialize()
            .set_content({
                title: localization.ConfirmResetExceptionsTitle,
                content: localization.ConfirmResetExceptionsText,
                ok: localization.ConfirmOK,
                cancel: localization.ConfirmCancel
            });
    },

    _updateValidator: function (validator) {
        var control = $("#" + validator.controltovalidate);

        if (control.is(".rsValidatedInput"))
            control = control.parent();

        if (!validator.isvalid)
            control.addClass("rsInvalid");
        else
            control.removeClass("rsInvalid");
    },

    _validatorIsInTemplate: function (validator) {
        return $(validator).parents().is("#" + this._schedulerElementId);
    },

    _createValidatorToolTip: function () {
        return $('<div></div>').hide().appendTo($('.rsAdvancedEdit:visible', $get(this._schedulerElementId)));
    },

    _showToolTip: function (e) {
        var toolTip = e.data.toolTip;
        var _control = $(this);
        var isTextArea = false;
        var controlParent = _control.parent();

        if (_control.is("textarea")) {
            isTextArea = true;
            _control = controlParent;
        }

        var isInvalid = _control.is(".rsInvalid");
        // Date and time pickers are validated against a hidden input located one level up in the DOM
        isInvalid = isInvalid || controlParent.parent().children().is(".rsInvalid");

        if (isInvalid) {
            toolTip
                    .css("visibility", "hidden")
                    .text(this.errorMessage)
                    .addClass("rsValidatorTooltip");

            var positionOrigin = _control;
            if (controlParent.is(".riCell"))
                positionOrigin = controlParent;

            var pos = positionOrigin.position();
            var toolTipLeft = pos.left + "px";

            if (isTextArea) {
                toolTipLeft = (pos.left + positionOrigin.outerWidth() - toolTip.outerWidth()) + "px";
            }

            var toolTipTop = (pos.top - toolTip.outerHeight()) + "px";
            toolTip
                    .css({
                        top: toolTipTop,
                        left: toolTipLeft,
                        zIndex: toolTipZIndex,
                        visibility: "visible"
                    })
                    .fadeIn("fast");
        }
    },

    _hideToolTip: function (e) {
        var toolTip = e.data.toolTip;
        toolTip.hide();
    },

    _hidePickerPopups: function () {
        if (!this._pickers)
            return;

        for (var pickerId in this._pickers) {
            var picker = this._pickers[pickerId];

            if (!picker)
                continue;

            if (picker.hideTimePopup)
                picker.hideTimePopup();
            else
                picker.hidePopup();
        }
    },

    _showPopup: function (sender) {
        this._hidePickerPopups();

        if (sender.Owner.showTimePopup)
            sender.Owner.showTimePopup();
        else
            sender.Owner.showPopup();
    }
};
        })();
    });

 
 
</script> 
</telerik:RadCodeBlock>

 

<div class="rsAdvancedEdit rsAdvancedModal" style="position: relative">
    <div class="rsModalBgTopLeft">
    </div>
    <div class="rsModalBgTopRight">
    </div>
    <div class="rsModalBgBottomLeft">
    </div>
    <div class="rsModalBgBottomRight">
    </div>
    <%-- Title bar. --%>
    <div class="rsAdvTitle">
        <%-- The rsAdvInnerTitle element is used as a drag handle when the form is modal. --%>
        <h1 class="rsAdvInnerTitle">
            <%= (this.Mode.ToString() == "Edit") ? Owner.Localization.AdvancedEditAppointment : Owner.Localization.AdvancedNewAppointment %></h1>
        <asp:linkbutton runat="server" id="AdvancedEditCloseButton" cssclass="rsAdvEditClose"
            commandname="Cancel" causesvalidation="false" tooltip='<%# Owner.Localization.AdvancedClose %>'>
            <%= Owner.Localization.AdvancedClose %>
        </asp:linkbutton>
    </div>
    <div class="rsAdvContentWrapper">
        <%-- Scroll container - when the form height exceeds MaximumHeight scrollbars will appear on this element--%>
        <div class="rsAdvOptionsScroll">
            <asp:panel runat="server" id="AdvancedEditOptionsPanel" cssclass="rsAdvOptions">
                <asp:panel runat="server" id="BasicControlsPanel" cssclass="rsAdvBasicControls" ondatabinding="BasicControlsPanel_DataBinding">
                    <telerik:RadTextBox runat="server" ID="SubjectText" Width="586px" Label='<%# Owner.Localization.AdvancedSubject + ":" %>'
                        EnableSingleInputRendering="false" Height="50px" />
                        <telerik:RadTextBox runat="server" ID="RadTextHiddenAppID"  Visible="false" />
                    <asp:requiredfieldvalidator runat="server" id="SubjectValidator" controltovalidate="SubjectText"
                        enableclientscript="true" display="None" cssclass="rsValidatorMsg" />
                    <ul class="rsTimePickers">
                        <li class="rsTimePick" style="width: 244px;">
                            <label for='<%= StartDate.ClientID %>_dateInput_text'>
                                <%= Owner.Localization.AdvancedFrom %></label><%--
           Leaving a newline here will affect the layout, so we use a comment instead.
                                --%><telerik:RadDatePicker runat="server" ID="StartDate" CssClass="rsAdvDatePicker"
                                    Width="85px" SharedCalendarID="SharedCalendar"
                                Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'
                                    MinDate="1900-01-01">
                                    <DatePopupButton Visible="false" />
                                    <DateInput ID="DateInput2" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>'
                                        EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" />
                                </telerik:RadDatePicker>
                            <%--
       
                            --%>
                            <telerik:RadTimePicker runat="server" ID="StartTime" CssClass="rsAdvTimePicker"
                                Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'>
                                <DateInput ID="DateInput3" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" "
                                    EnableSingleInputRendering="false" />
                                <TimePopupButton Visible="false" />
                                <TimeView ID="TimeView1" runat="server" Columns="2" ShowHeader="false" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                            </telerik:RadTimePicker>
                        </li>
                        <li class="rsTimeZonesWrapper">
                            <telerik:RadComboBox runat="server" Visible="true" ID="TimeZonesDropDown" Width="230"
                                Label="<%# Owner.Localization.AdvancedTimeZone %>" Skin='<%# Owner.Skin %>'>
                            </telerik:RadComboBox>
                        </li>
                        <li class="rsAllDayWrapper">
                            <asp:checkbox runat="server" id="AllDayEvent" cssclass="rsAdvChkWrap" checked="false" />
                        </li>
                        <li class="rsTimePick rsEndTimePick" style="width: 244px;">
                            <label for='<%= EndDate.ClientID %>_dateInput_text'>
                                <%= Owner.Localization.AdvancedTo%></label><%--
       
                                --%><telerik:RadDatePicker runat="server" ID="EndDate" CssClass="rsAdvDatePicker"
                                    Width="85px" SharedCalendarID="SharedCalendar"
                                Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'
                                    MinDate="1900-01-01">
                                    <DatePopupButton Visible="false" />
                                    <DateInput ID="DateInput4" runat="server" DateFormat='<%# Owner.AdvancedForm.DateFormat %>'
                                        EmptyMessageStyle-CssClass="riError" EmptyMessage=" " EnableSingleInputRendering="false" />
                                </telerik:RadDatePicker>
                            <%--
       
                            --%>
                            <telerik:RadTimePicker runat="server" ID="EndTime" CssClass="rsAdvTimePicker"
                                Width="65px" Skin='<%# Owner.Skin %>' Culture='<%# Owner.Culture %>'>
                                <DateInput ID="DateInput5" runat="server" EmptyMessageStyle-CssClass="riError" EmptyMessage=" "
                                    EnableSingleInputRendering="false" />
                                <TimePopupButton Visible="false" />
                                <TimeView ID="TimeView2" runat="server" Columns="2" ShowHeader="false" StartTime="08:00"
                                    EndTime="18:00" Interval="00:30" />
                            </telerik:RadTimePicker>
                        </li>
                    </ul>
                    <div class="rsReminderWrapper" style="display:none;">
                        <telerik:RadComboBox runat="server" ID="ReminderDropDown" Width="120px" Skin='<%# Owner.Skin %>'
                            Label="<%# Owner.Localization.Reminder %>">
                            <Items>
                                <telerik:RadComboBoxItem Text='<%# Owner.Localization.ReminderNone %>' Value="" />
                                <telerik:RadComboBoxItem Text='<%# "0 " + Owner.Localization.ReminderMinutes %>'
                                    Value="0" />
                                <telerik:RadComboBoxItem Text='<%# "5 " + Owner.Localization.ReminderMinutes %>'
                                    Value="5" />
                                <telerik:RadComboBoxItem Text='<%# "10 " + Owner.Localization.ReminderMinutes %>'
                                    Value="10" />
                                <telerik:RadComboBoxItem Text='<%# "15 " + Owner.Localization.ReminderMinutes %>'
                                    Value="15" />
                                <telerik:RadComboBoxItem Text='<%# "30 " + Owner.Localization.ReminderMinutes %>'
                                    Value="30" />
                                <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderHour %>' Value="60" />
                                <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderHours %>' Value="120" />
                                <telerik:RadComboBoxItem Text='<%# "3 " + Owner.Localization.ReminderHours %>' Value="180" />
                                <telerik:RadComboBoxItem Text='<%# "4 " + Owner.Localization.ReminderHours %>' Value="240" />
                                <telerik:RadComboBoxItem Text='<%# "5 " + Owner.Localization.ReminderHours %>' Value="300" />
                                <telerik:RadComboBoxItem Text='<%# "6 " + Owner.Localization.ReminderHours %>' Value="360" />
                                <telerik:RadComboBoxItem Text='<%# "7 " + Owner.Localization.ReminderHours %>' Value="420" />
                                <telerik:RadComboBoxItem Text='<%# "8 " + Owner.Localization.ReminderHours %>' Value="480" />
                                <telerik:RadComboBoxItem Text='<%# "9 " + Owner.Localization.ReminderHours %>' Value="540" />
                                <telerik:RadComboBoxItem Text='<%# "10 " + Owner.Localization.ReminderHours %>' Value="600" />
                                <telerik:RadComboBoxItem Text='<%# "11 " + Owner.Localization.ReminderHours %>' Value="660" />
                                <telerik:RadComboBoxItem Text='<%# "12 " + Owner.Localization.ReminderHours %>' Value="720" />
                                <telerik:RadComboBoxItem Text='<%# "18 " + Owner.Localization.ReminderHours %>' Value="1080" />
                                <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderDays %>' Value="1440" />
                                <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderDays %>' Value="2880" />
                                <telerik:RadComboBoxItem Text='<%# "3 " + Owner.Localization.ReminderDays %>' Value="4320" />
                                <telerik:RadComboBoxItem Text='<%# "4 " + Owner.Localization.ReminderDays %>' Value="5760" />
                                <telerik:RadComboBoxItem Text='<%# "1 " + Owner.Localization.ReminderWeek %>' Value="10080" />
                                <telerik:RadComboBoxItem Text='<%# "2 " + Owner.Localization.ReminderWeeks %>' Value="20160" />
                            </Items>
                        </telerik:RadComboBox>
                    </div>
                    <asp:requiredfieldvalidator runat="server" id="StartDateValidator" controltovalidate="StartDate"
                        enableclientscript="true" display="None" cssclass="rsValidatorMsg" />
                    <asp:requiredfieldvalidator runat="server" id="StartTimeValidator" controltovalidate="StartTime"
                        enableclientscript="true" display="None" cssclass="rsValidatorMsg" />
                    <asp:requiredfieldvalidator runat="server" id="EndDateValidator" controltovalidate="EndDate"
                        enableclientscript="true" display="None" cssclass="rsValidatorMsg" />
                    <asp:requiredfieldvalidator runat="server" id="EndTimeValidator" controltovalidate="EndTime"
                        enableclientscript="true" display="None" cssclass="rsValidatorMsg" />
                    <asp:customvalidator runat="server" id="DurationValidator" controltovalidate="StartDate"
                        enableclientscript="false" display="Dynamic" cssclass="rsValidatorMsg rsInvalid"
                        onservervalidate="DurationValidator_OnServerValidate" />
                </asp:panel>
                <asp:panel runat="server" id="AdvancedControlsPanel" cssclass="rsAdvMoreControls">
                    <telerik:RadComboBox ID="ContinentsRadComboBox" runat="server" Width="186px" Label="Select Person:"
                        OnClientSelectedIndexChanged="LoadCountries" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"  ControlToValidate="ContinentsRadComboBox" enableclientscript="true" display="None" cssclass="rsValidatorMsg" >
                        </asp:RequiredFieldValidator>
                    <telerik:RadComboBox ID="CountriesRadComboBox" runat="server" Label="Select Tag:" Width="186px"
                        OnItemsRequested="CountriesRadComboBox_ItemsRequested" OnClientItemsRequested="CountriesLoaded"
                        OnClientLoad="CountriesComboClientLoad" EnableViewState="false" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"  ControlToValidate="CountriesRadComboBox" enableclientscript="true" display="None" cssclass="rsValidatorMsg" >
                        </asp:RequiredFieldValidator>
                </asp:panel>
               
                <telerik:RadTextBox runat="server" ID="DescriptionText" TextMode="SingleLine" Columns="1"
                    Rows="5" Width="586px" Label='<%# Owner.Localization.AdvancedDescription + ":" %>'
                    Text='<%# Eval("Description") %>' EnableSingleInputRendering="false" Visible="false" />
                <span class="rsAdvResetExceptions">
                    <asp:linkbutton runat="server" id="ResetExceptions" onclick="ResetExceptions_OnClick" />
                </span>
                <telerik:RadSchedulerRecurrenceEditor runat="server" ID="AppointmentRecurrenceEditor" />
                <asp:hiddenfield runat="server" id="OriginalRecurrenceRule" />
                <telerik:RadCalendar runat="server" ID="SharedCalendar" Skin='<%# Owner.Skin %>'
                    CultureInfo='<%# Owner.Culture %>' ShowRowHeaders="false" RangeMinDate="1900-01-01" />
            </asp:panel>
        </div>
        <asp:panel runat="server" id="ButtonsPanel" cssclass="rsAdvancedSubmitArea">
            <div class="rsAdvButtonWrapper">
                <asp:linkbutton runat="server" id="UpdateButton" cssclass="rsAdvEditSave" >
                    <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>
    </div>
</div>

 

d) AdvanceForm.ascx.cs
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.ComponentModel;

using System.Drawing;
using Telerik.Web.UI;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using OnCallSolution.WPScedulerSharepointWebpart;

 

/// <summary>
/// Specifies the advanced form mode.
/// </summary>
public enum AdvancedFormMode
{
    Insert,
    Edit
}

namespace OnCallSolution.ControlTemplates.OnCallSolution
{
    public partial class AdvancedForm : UserControl
    {
        #region Private members

        private string _selectedCountry;

        public int _ContactID;
        public string _TagName;
        public string _PersonName;
        public string _Tag;

        public int _ContactIDofPerson;
        public int _Asset_Contact_Tag_ID;

      

        private bool FormInitialized
        {
            get
            {
                return (bool)(ViewState["FormInitialized"] ?? false);
            }

            set
            {
                ViewState["FormInitialized"] = value;
            }
        }

        private AdvancedFormMode mode = AdvancedFormMode.Insert;

        #endregion

        #region Protected properties

        protected RadScheduler Owner
        {
            get
            {
                return Appointment.Owner;
            }
        }

        protected Appointment Appointment
        {
            get
            {
                SchedulerFormContainer container = (SchedulerFormContainer)BindingContainer;
                return container.Appointment;
            }
        }

        #endregion

        #region Attributes and resources

        //Continent, Coutry  
        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string Continent
        {
            get
            {
                return ContinentsRadComboBox.SelectedValue;
                //insert the first item
            }

            set
            {
                ContinentsRadComboBox.SelectedValue = value;
              
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string Country
        {
            get
            {
                return CountriesRadComboBox.SelectedValue;
            }

            set
            {
                // Store the selected country ID until we obtain the continent ID  
                _selectedCountry = value;
            }
        }

        ////values set for custom things for person and Tag combobox
        //[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        //public string ContinentPersonName
        //{
        //    get
        //    {
        //        return ContinentsRadComboBox.SelectedItem.Text.ToString();
        //        //insert the first item
        //    }

        //    set
        //    {
        //        _PersonName = value;
        //    }
        //}

        //[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        //public string CountryTagName
        //{
        //    get
        //    {
        //        return CountriesRadComboBox.SelectedItem.Text.ToString();
        //    }

        //    set
        //    {
        //        // Store the selected country ID until we obtain the continent ID  
        //        _Tag = value;
        //    }
        //}

      

        protected void LoadContinents()
        {
            SqlConnection connection = new SqlConnection(
            ConfigurationManager.ConnectionStrings["OnCallConnectionString"].ConnectionString);

            string query = @"select  distinct AC.Contact_ID, C.Name from  OC_Asset_Contact_Tag AC join
                            OC_Asset_Tag_Master T on AC.Asset_Tags_Master_ID=T.Asset_Tags_Master_ID
                            join dbo.OC_Contact C on C.Contact_ID=AC.Contact_ID
                            where AC.Status=1
                            and C.Status=1
                            order by c.Name";

            SqlDataAdapter adapter = new SqlDataAdapter(query, connection);
            DataTable dt = new DataTable();
            adapter.Fill(dt);
            ContinentsRadComboBox.Items.Clear();
            ContinentsRadComboBox.Items.Insert(0, new RadComboBoxItem("- Select a Contact -"));
            ContinentsRadComboBox.AppendDataBoundItems = true;
            ContinentsRadComboBox.DataTextField = "Name";
            ContinentsRadComboBox.DataValueField = "Contact_ID";
            ContinentsRadComboBox.DataSource = dt;
            ContinentsRadComboBox.DataBind();
            ContinentsRadComboBox.DataSource = null;
          

        }

        public void LoadCountries(string ContactID)//previous working method was private  public void LoadCountries(string ContactID)
        {
            SqlConnection connection = new SqlConnection(
            ConfigurationManager.ConnectionStrings["OnCallConnectionString"].ConnectionString);

            //select a country based on the continentID
            string query = @" Select distinct T.Asset_Tags_Master_ID,t.Tag_Name  from OC_Asset_Contact_Tag CT
                            inner join  OC_Asset_Tag_Master T 
                            on t.Asset_Tags_Master_ID=ct.Asset_Tags_Master_ID
                            inner join OC_Contact C on c.Contact_ID=  ct.Contact_ID
                            where C.Contact_ID=@Contact_ID
                            and ct.Status=1";
            SqlDataAdapter adapter = new SqlDataAdapter(query, connection);
            adapter.SelectCommand.Parameters.AddWithValue("@Contact_ID", ContactID);

            DataTable dt = new DataTable();
            adapter.Fill(dt);

            CountriesRadComboBox.DataTextField = "Tag_Name";
            CountriesRadComboBox.DataValueField = "Asset_Tags_Master_ID";
            CountriesRadComboBox.DataSource = dt;
            CountriesRadComboBox.DataBind();
        }

        protected void CountriesRadComboBox_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            // e.Text is the first parameter of the requestItems method   
            // invoked in LoadCountries method   
            LoadCountries(e.Text);

            //RadComboBox rcb_PersonName = (RadComboBox)e.Container.Controls[1].Controls[1].FindControl("ContinentsRadComboBox");

            //RadComboBox rcb_Tag = (RadComboBox)e.Container.Controls[1].Controls[1].FindControl("CountriesRadComboBox");
           

        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string Description
        {
            get
            {
                return DescriptionText.Text;
            }

            set
            {
                DescriptionText.Text = value;
            }
        }

 

        #endregion

        #region Public properties

        public AdvancedFormMode Mode
        {
            get
            {
                return mode;
            }
            set
            {
                mode = value;
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string Subject
        {
            get
            {
                return SubjectText.Text;
            }

            set
            {
                SubjectText.Text = value;
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public DateTime Start
        {
            get
            {
                DateTime result = StartDate.SelectedDate.Value.Date;

                if (AllDayEvent.Checked)
                {
                    result = result.Date;
                }
                else
                {
                    TimeSpan time = StartTime.SelectedDate.Value.TimeOfDay;
                    result = result.Add(time);
                }

                return Owner.DisplayToUtc(result);
            }

            set
            {
                StartDate.SelectedDate = Owner.UtcToDisplay(value);
                StartTime.SelectedDate = Owner.UtcToDisplay(value);
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public DateTime End
        {
            get
            {
                DateTime result = EndDate.SelectedDate.Value.Date;

                if (AllDayEvent.Checked)
                {
                    result = result.Date.AddDays(1);
                }
                else
                {
                    TimeSpan time = EndTime.SelectedDate.Value.TimeOfDay;
                    result = result.Add(time);
                }

                return Owner.DisplayToUtc(result);
            }

            set
            {
                EndDate.SelectedDate = Owner.UtcToDisplay(value);
                EndTime.SelectedDate = Owner.UtcToDisplay(value);
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string RecurrenceRuleText
        {
            get
            {
                if (Owner.RecurrenceSupport)
                {
                    bool dateSpecified = StartDate.SelectedDate.HasValue && EndDate.SelectedDate.HasValue;
                    bool timeSpecified = StartTime.SelectedDate.HasValue && EndTime.SelectedDate.HasValue;

                    if ((AllDayEvent.Checked && !dateSpecified) ||
                        (!AllDayEvent.Checked && !(dateSpecified && timeSpecified)))
                    {
                        return string.Empty;
                    }

                    AppointmentRecurrenceEditor.StartDate = Start;
                    AppointmentRecurrenceEditor.EndDate = End;

                    RecurrenceRule rrule = AppointmentRecurrenceEditor.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 = Owner.DisplayToUtc(rrule.Range.RecursUntil);

                        if (!AllDayEvent.Checked)
                        {
                            rrule.Range.RecursUntil = rrule.Range.RecursUntil.AddDays(1);
                        }
                    }

                    return rrule.ToString();
                }

                return string.Empty;
            }

            set
            {
                RecurrenceRule rrule;
                RecurrenceRule.TryParse(value, out rrule);

                if (rrule != null)
                {
                    if (rrule.Range.RecursUntil != DateTime.MaxValue)
                    {
                        DateTime recursUntil = Owner.UtcToDisplay(rrule.Range.RecursUntil);

                        if (!IsAllDayAppointment(Appointment))
                        {
                            recursUntil = recursUntil.AddDays(-1);
                        }

                        rrule.Range.RecursUntil = recursUntil;
                    }

                    AppointmentRecurrenceEditor.RecurrenceRule = rrule;

                    OriginalRecurrenceRule.Value = value;
                }
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string Reminder
        {
            get
            {
                if (Owner.RemindersSupport && ReminderDropDown.SelectedValue != string.Empty)
                {
                    return ReminderDropDown.SelectedValue;
                }

                return string.Empty;
            }

            set
            {
                RadComboBoxItem item = ReminderDropDown.Items.FindItemByValue(value);
                if (item != null)
                {
                    item.Selected = true;
                }
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string TimeZoneID
        {
            get
            {
                return TimeZonesDropDown.SelectedValue;
            }

            set
            {

                RadComboBoxItem item = TimeZonesDropDown.Items.FindItemByValue(value);
                if (item != null)
                {
                    item.Selected = true;
                }
            }
        }

       // object RecurrenceParentID;

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public int Asset_Contact_Tag_ID
        {
            get
            {
                return Convert.ToInt32(ContinentsRadComboBox.SelectedValue);
            }

            set
            {
                // Store the selected country ID until we obtain the continent ID  
                _Asset_Contact_Tag_ID = value;
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public int ContactID
        {
            get
            {
                return Convert.ToInt32(CountriesRadComboBox.SelectedValue);
            }

            set
            {
                // Store the selected country ID until we obtain the continent ID  
                _ContactIDofPerson = value;
            }
        }

        //values set for custom things for person and Tag combobox
        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string ContinentPersonName
        {
            get
            {
                return ContinentsRadComboBox.SelectedItem.Text.ToString();
              
            }

            set
            {
                _PersonName = value;
            }
        }

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string CountryTagName
        {
            get
            {
                return CountriesRadComboBox.SelectedItem.Text.ToString();
            }

            set
            {
                // Store the selected country ID until we obtain the continent ID  
                _Tag = value;
            }
        }

 

 

        #endregion

        /// <summary>
        /// Page load method for loading the appointments
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ContinentsRadComboBox.Items.Count == 0)
            {
               
                // Fill the continents combo  
                LoadContinents();
            }

            UpdateButton.ValidationGroup = Owner.ValidationGroup;
            UpdateButton.CommandName = Mode == AdvancedFormMode.Edit ? "Update" : "Insert";

            //create Save button event when in run time to save the Appointment
            UpdateButton.Command += new System.Web.UI.WebControls.CommandEventHandler(UpdateButton_Command);

            if (Owner.AdvancedForm.EnableTimeZonesEditing)
                PopulateTimeZonesDropDown();
            else
                TimeZonesDropDown.Visible = false;

            if (!Owner.Reminders.Enabled)
                ReminderDropDown.Visible = false;

            InitializeStrings();
            InitializeRecurrenceEditor();

            if (!FormInitialized)
            {
                UpdateResetExceptionsVisibility();
            }
        }

        /// <summary>
        /// On Pre lender method for to set localzation
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
           
            if (!string.IsNullOrEmpty(_selectedCountry))
            {
                // Fill the countries combo.  
                // Note that Continent value is available in PreRender  
                LoadCountries(Continent);
                CountriesRadComboBox.SelectedValue = _selectedCountry;
            }

            if (!FormInitialized)
            {
                if (IsAllDayAppointment(Appointment))
                {
                    EndDate.SelectedDate = EndDate.SelectedDate.Value.AddDays(-1);
                }

                FormInitialized = true;
            }

            if (String.IsNullOrEmpty(Appointment.TimeZoneID))
                TimeZoneID = Owner.TimeZonesProvider.OperationTimeZone.TimeZoneId;
            else
                TimeZoneID = Appointment.TimeZoneID;

            //if (!string.IsNullOrEmpty(_PersonName) && !string.IsNullOrEmpty(_Tag))
            //{
            //    // Fill the countries combo.  
            //    // Note that Continent value is available in PreRender  
            //    //fill the Person name and Tag Name while selected it from the downdown and put it in subject
            //    Subject += "  "+_PersonName;
            //    Subject += _Tag;

               
            //}

        }

        /// <summary>
        /// Populating the AllZones
        /// </summary>
        private void PopulateTimeZonesDropDown()
        {
            TimeZonesDropDown.DataSource = Owner.TimeZonesProvider.GetAllTimeZones();
            TimeZonesDropDown.DataTextField = "DisplayName";
            TimeZonesDropDown.DataValueField = "Id";
        }

        protected void BasicControlsPanel_DataBinding(object sender, EventArgs e)
        {
            AllDayEvent.Checked = IsAllDayAppointment(Appointment);
        }

        protected void DurationValidator_OnServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = (End - Start) > TimeSpan.Zero;
        }

        protected void ResetExceptions_OnClick(object sender, EventArgs e)
        {
            Owner.RemoveRecurrenceExceptions(Appointment);
            OriginalRecurrenceRule.Value = Appointment.RecurrenceRule;
            ResetExceptions.Text = Owner.Localization.AdvancedDone;
        }

        #region Private methods

        private void InitializeStrings()
        {
            SubjectValidator.ErrorMessage = Owner.Localization.AdvancedSubjectRequired;
            SubjectValidator.ValidationGroup = Owner.ValidationGroup;

            AllDayEvent.Text = Owner.Localization.AdvancedAllDayEvent;

            StartDateValidator.ErrorMessage = Owner.Localization.AdvancedStartDateRequired;
            StartDateValidator.ValidationGroup = Owner.ValidationGroup;

            StartTimeValidator.ErrorMessage = Owner.Localization.AdvancedStartTimeRequired;
            StartTimeValidator.ValidationGroup = Owner.ValidationGroup;

            EndDateValidator.ErrorMessage = Owner.Localization.AdvancedEndDateRequired;
            EndDateValidator.ValidationGroup = Owner.ValidationGroup;

            EndTimeValidator.ErrorMessage = Owner.Localization.AdvancedEndTimeRequired;
            EndTimeValidator.ValidationGroup = Owner.ValidationGroup;

            DurationValidator.ErrorMessage = Owner.Localization.AdvancedStartTimeBeforeEndTime;
            DurationValidator.ValidationGroup = Owner.ValidationGroup;

            ResetExceptions.Text = Owner.Localization.AdvancedReset;

            SharedCalendar.FastNavigationSettings.OkButtonCaption = Owner.Localization.AdvancedCalendarOK;
            SharedCalendar.FastNavigationSettings.CancelButtonCaption = Owner.Localization.AdvancedCalendarCancel;
            SharedCalendar.FastNavigationSettings.TodayButtonCaption = Owner.Localization.AdvancedCalendarToday;

        }

        private void InitializeRecurrenceEditor()
        {
            AppointmentRecurrenceEditor.SharedCalendar = SharedCalendar;
            AppointmentRecurrenceEditor.Culture = Owner.Culture;
            AppointmentRecurrenceEditor.StartDate = Appointment.Start;
            AppointmentRecurrenceEditor.EndDate = Appointment.End;
        }

        private void UpdateResetExceptionsVisibility()
        {
            // Render the reset exceptions checkbox when using web service binding
            if (string.IsNullOrEmpty(Owner.WebServiceSettings.Path))
            {
                ResetExceptions.Visible = false;
                RecurrenceRule rrule;
                if (RecurrenceRule.TryParse(Appointment.RecurrenceRule, out rrule))
                {
                    ResetExceptions.Visible = rrule.Exceptions.Count > 0;
                }
            }
        }

        private bool IsAllDayAppointment(Appointment appointment)
        {
            DateTime displayStart = Owner.UtcToDisplay(appointment.Start);
            DateTime displayEnd = Owner.UtcToDisplay(appointment.End);
            return displayStart.CompareTo(displayStart.Date) == 0 && displayEnd.CompareTo(displayEnd.Date) == 0;
        }

        #region Events

        UserInfoManupulator ui = new UserInfoManupulator();
        void UpdateButton_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e)
        {

            #region Insert Command

            if (e.CommandName == "Insert")
            {
                OC_Scheduler_Appointment appointmentAdd = new OC_Scheduler_Appointment();
                // AdvancedForm o = new AdvancedForm();//for accesing the public proerties from the advanced from
                try
                {
                    appointmentAdd.Subject = Subject;// e.Appointment.Subject.ToString();
                    appointmentAdd.Start = Start;// e.Appointment.Start;
                    appointmentAdd.End = End;// e.Appointment.End;
                    appointmentAdd.Description = Description;// e.Appointment.Description;
                    appointmentAdd.RecurrenceRule = RecurrenceRuleText;// e.Appointment.RecurrenceRule.ToString();
                    appointmentAdd.TimeZone = TimeZoneID;// .Appointment.TimeZoneID;
                    appointmentAdd.Asset_Contact_Tag_ID = Asset_Contact_Tag_ID;// ContactID;// o._ContactIDofPerson;
                    appointmentAdd.Shift_ID = 1;//temporary hard coaded values here 1 or 2
                    appointmentAdd.Reminder = Reminder;// e.Appointment.Reminders.ToString();
                    appointmentAdd.Annotations = "";
                    appointmentAdd.Updated_By = ui.GetCurrentUserLoginName();
                    appointmentAdd.Update_Time = System.DateTime.UtcNow;

                    DataTable dt = null;
                    dt = appointmentAdd.getAsset_Contact_Tag_ID(Asset_Contact_Tag_ID, ContactID);

                    if (dt != null)
                    {
                        appointmentAdd.Asset_Contact_Tag_ID = Convert.ToInt32(dt.Rows[0]["Asset_Contact_Tag_ID"]);
                    }

                    dt = null;

                    dt = appointmentAdd.get_Shift_ID(appointmentAdd.Shift_ID);

                    if (dt != null)
                    {
                        appointmentAdd.Shift_ID = Convert.ToInt32(dt.Rows[0]["Shift_ID"]);
                    }

                    //if Recurrent not done then RecurrenceParentID is 0 so send  value null to the database
                    if (appointmentAdd.RecurrenceParentID == 0)
                    {
                        //Insert all values along with the recurentceParentID NULL if not recurrence done
                        //int? tempRPID = sys.null;
                        //appointmentAdd.RecurrenceParentID = tempRPID;
                        int saveOrNot = appointmentAdd.saveApointmentDataWithRecureenceParentIDNull(appointmentAdd);
                    }
                    else
                    {

                        //Insert all values along with the recurentceParentID
                        // appointmentAdd.RecurrenceParentID = (int?)RecurrenceParentID;
                        int saveOrNot = appointmentAdd.saveApointmentData(appointmentAdd);

                        //get latest insterted record
                        //SELECT ID FROM Appointments WHERE id=(SELECT max(id) FROM Appointments)

 

                    }

 

                }
                catch (Exception ex)
                {
                }

            }
            #endregion

            #region Update Command

            if (e.CommandName == "Update")
            {

                OC_Scheduler_Appointment appointmentUpdate = new OC_Scheduler_Appointment();
                try
                {
                    appointmentUpdate.Subject = Subject;
                    appointmentUpdate.Start = Start;
                    appointmentUpdate.End = End;
                    appointmentUpdate.Description = Description;
                    appointmentUpdate.RecurrenceRule = RecurrenceRuleText;
                    appointmentUpdate.TimeZone = TimeZoneID;
                    appointmentUpdate.Asset_Contact_Tag_ID = Asset_Contact_Tag_ID;
                    appointmentUpdate.Shift_ID = 1;
                    appointmentUpdate.Reminder = Reminder;
                    appointmentUpdate.Annotations = "";
                    appointmentUpdate.Updated_By = ui.GetCurrentUserLoginName();
                    appointmentUpdate.Update_Time = System.DateTime.UtcNow;

                   
                   

                    //DataTable dt = null;
                    //dt = appointmentAdd.getAsset_Contact_Tag_ID(Asset_Contact_Tag_ID, ContactID);

                    //if (dt != null)
                    //{
                    //    appointmentAdd.Asset_Contact_Tag_ID = Convert.ToInt32(dt.Rows[0]["Asset_Contact_Tag_ID"]);
                    //}

                    //dt = null;

                    //dt = appointmentAdd.get_Shift_ID(appointmentAdd.Shift_ID);

                    //if (dt != null)
                    //{
                    //    appointmentAdd.Shift_ID = Convert.ToInt32(dt.Rows[0]["Shift_ID"]);
                    //}

                    ////if Recurrent not done then RecurrenceParentID is 0 so send  value null to the database
                    //if (appointmentAdd.RecurrenceParentID == 0)
                    //{
                    //    //Insert all values along with the recurentceParentID NULL if not recurrence done
                    //    //int? tempRPID = sys.null;
                    //    //appointmentAdd.RecurrenceParentID = tempRPID;
                    //    int saveOrNot = appointmentAdd.saveApointmentDataWithRecureenceParentIDNull(appointmentAdd);
                    //}
                    //else
                    //{

                    //    //Insert all values along with the recurentceParentID
                    //    // appointmentAdd.RecurrenceParentID = (int?)RecurrenceParentID;
                    //    int saveOrNot = appointmentAdd.saveApointmentData(appointmentAdd);

                    //    //get latest insterted record
                    //    //SELECT ID FROM Appointments WHERE id=(SELECT max(id) FROM Appointments)
                    //}

 

                }
                catch (Exception ex)
                {
                }
            }
           
            #endregion
        }

        #endregion

        #endregion
    }
}

My issues are I am not able to get the public properties values from AdvancedForm.ascx to WPScedulerSharepointWebpartUserControl.ascx and Vice Versa.

 

Plamen
Telerik team
 answered on 15 May 2013
3 answers
459 views
Hi,

Please can I have some help as so far every thing I have tried with the grid has not worked as expected and I have now logged 3 posts where functions that should work just don't seem to.  Perhaps it is the way in which I am populating my grid?  All columns and data are created dynamically in code-behind as I do not know what will be displayed.  

Essentially I have just added export to excel via the CommandItem as per

<MasterTableView Height="30px" CommandItemDisplay="Top">
<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowExportToPdfButton="true" />
<Columns>
<telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="false" />
</Columns>
</MasterTableView>

From the demo project I have also implemented the events

OnItemDataBound="gridEvents_ItemDataBound" 
OnItemCommand="gridEvents_ItemCommand"
OnBiffExporting="gridEvents_ExportToExcel"

Although when looking at the code in the sample this actually does nothing in most cases.  I have also added the 

using eis = Telerik.Web.UI.ExportInfrastructure;

line to the top of my file - this is easy to miss as it is not mentioned in the sample.  I see the buttons (although the refresh button is disabled?) but when clicking export to excel/pdf nothing happens, no errors no calling of the above events nothing.

Can someone (maybe from Teleik?) let me know what the common factor is here - why does export to excel / row drag and drop not work for me?  Started to get frustrated here as I was trying to move away from Infragistics as their grid was somewhat complex/heavy but at least I could get it to work!
Kostadin
Telerik team
 answered on 15 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?