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

customizing AdvancedEditTemplate takes too much time for form creating

9 Answers 107 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 25 Jan 2012, 10:58 AM
Hi,

I am using radsheduler. and customizing advancedinsertTemplate and advancedEditTemplate. but the edit form creating it takes long time. i am using ajax. but when clikcing edit button the page has loaded. and masterpage loaded. after that form created. so it will take more than 12 seconds. but i want improve the performance. please let me know how to avoid masterpage load when form created.


Thanks in Advance.
Dhamu

9 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 Jan 2012, 10:41 AM
Hi Dhamu,

You can significantly improve performance if you use Web Service binding to populate RadScheduler. You can download a stand-alon sample from the code library.

Greetings,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Dhamodharan
Top achievements
Rank 1
answered on 06 Feb 2012, 06:23 PM
Hi Peter,

I am using advancedinserttemplate. i am not able to using webservice with advancedInsertTemplate. please let me know ASAP.

Thanks,
Dhamu.
0
Dhamodharan
Top achievements
Rank 1
answered on 08 Feb 2012, 11:31 AM
Hi, 

Any idea. please it is very urgent. please let me know ASAP.


Thanks,
Dhamu
0
Peter
Telerik team
answered on 08 Feb 2012, 02:42 PM
Hi,

You can try the general top performance tips - http://www.telerik.com/products/aspnet-ajax/getting-started/top-performance.aspx.

However, any irmprovement in performance using those tips would be negligible compared to what you would get using Web Service binding. I advise you to try to overcome the obstacles you have to using Web Service binding so that you can reap the performance benefits you would get with this mode.

Greetings,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Dhamodharan
Top achievements
Rank 1
answered on 08 Feb 2012, 02:55 PM
Hi,

I just ask sample for how to create advancedInsertTemplate with wbservice binding,

Please give a sample code for analyze.


Thanks,
Dhamu.
0
Peter
Telerik team
answered on 13 Feb 2012, 04:09 PM


There is a sample in the code library entry I referred you to. There you will find a WebServiceBinding folder.

Kind regards,
Peter
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Dhamodharan
Top achievements
Rank 1
answered on 20 Feb 2012, 08:00 AM
Hi Peter,

I am using that code. but the appointment not display into scheduler. but the select query got record and return appointment but not display into scheduler. please check and let me know,

Please check the code,

aspx
------
<telerik:RadScriptBlock ID="rsbScript" runat="server">   
    <script type="text/javascript">
        //<![CDATA[
        var categoryNames = new Array();

        function OnClientAppointmentsPopulating(sender, eventArgs) {
            //addSelectedCategoriesToArray(categoryNames);
            eventArgs.get_schedulerInfo().CategoryNames = categoryNames;
            categoryNames = new Array(); //clear the array
        }
      
        function OnClientAppointmentWebServiceInserting(sender, args) {
            //set a default Calendar resource
            if (args.get_appointment().get_resources().get_count() == 0) {
                var defaultCalendarResource = sender.get_resources().getResourceByTypeAndKey("Calendar", 1);
                args.get_appointment().get_resources().add(defaultCalendarResource);
            }
        }   

        function rebindScheduler() {
            var scheduler = $find('<%=RadScheduler1.ClientID %>');
            scheduler.rebind();
        }

        function onSchedulerDataBound(scheduler) {
            var $ = jQuery;
            $(".rsAptDelete").each(function () {
                var apt = scheduler.getAppointmentFromDomElement(this);
                // creating an object containing the data that should be applied on the template
                var tmplValue = { Description: apt.get_description() };
                // instantiate the template, populate it and insert before the delete handler (".rsAptDelete")
                $("#tmplAppDescription").tmpl(tmplValue).insertBefore(this);
            });
        }
      
         //]]>
    </script>
    </telerik:RadScriptBlock>

<form id="form1" runat="server">
     <telerik:RadScriptManager runat="server" ID="RadScriptManager1">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            <%--<asp:ScriptReference Path="Scripts/jquery.tmpl.js" />--%>
        </Scripts>
    </telerik:RadScriptManager>
    <div>
     <telerik:RadScheduler runat="server" ID="RadScheduler1" Skin="Windows7" Height="551px"
                    OnClientAppointmentWebServiceInserting="OnClientAppointmentWebServiceInserting"
                    OnClientAppointmentsPopulating="OnClientAppointmentsPopulating"
                    SelectedView="MonthView" ShowFooter="false" SelectedDate="2012-02-15" TimeZoneOffset="03:00:00"
                    DayStartTime="08:00:00" DayEndTime="21:00:00" FirstDayOfWeek="Monday" LastDayOfWeek="Friday"
                    EnableDescriptionField="true" AppointmentStyleMode="Default">
                    <WebServiceSettings Path="WebServiceScheduler.asmx" ResourcePopulationMode="ServerSide" />
                    <AdvancedForm Modal="true" />
                    <TimelineView UserSelectable="false" />                   
                    <TimeSlotContextMenuSettings EnableDefault="true" />
                    <AppointmentContextMenuSettings EnableDefault="true" />
                </telerik:RadScheduler>
    </div>
     <telerik:RadAjaxLoadingPanel ID="ralpScheduler" Style="position: absolute" runat="server">
            </telerik:RadAjaxLoadingPanel>
    </form>

webServiceScheduler.vb(webservice)
Imports System.Collections.Generic
Imports System.Web.Script.Services
Imports System.Web.Services
Imports Telerik.Web.UI
Imports System.Data.Common

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService()> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ScriptService()> _
Public Class WebServiceScheduler
    Inherits System.Web.Services.WebService

    Private _controller As WebServiceAppointmentController

    ''' <summary>
    ''' The WebServiceAppointmentController class is used as a facade to the SchedulerProvider.
    ''' </summary>
    '''
    Private _provider As MyDbSchedulerProvider
    Private ReadOnly Property Provider() As MyDbSchedulerProvider
        Get
            If _provider Is Nothing Then
                Dim connString = ConfigurationManager.ConnectionStrings("TelerikVSXConnectionString").ConnectionString
                Dim factory = DbProviderFactories.GetFactory("System.Data.SqlClient")
                _provider = New MyDbSchedulerProvider() With { _
                 .ConnectionString = connString, _
                 .DbFactory = factory, _
                 .PersistChanges = True _
                }
            End If
            Return _provider
        End Get
    End Property
    Private ReadOnly Property Controller() As WebServiceAppointmentController      
        Get
            If _controller Is Nothing Then
                _controller = New WebServiceAppointmentController(Provider)
            End If
            Return _controller
        End Get
    End Property

    <WebMethod()> _
    Public Function GetAppointments(ByVal schedulerInfo As SchedulerInfo) As IEnumerable(Of AppointmentData)
        Return Controller.GetAppointments(schedulerInfo)
    End Function

Class File - App_code/MyDbSchedulerProvider.vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Data.Common
Imports System.Data.SqlClient
Imports Telerik.Web.UI

Public Class MyDbSchedulerProvider

  Public Overrides Function GetAppointments(ByVal shedulerInfo As ISchedulerInfo) As IEnumerable(Of Appointment)
        Dim appointments As New List(Of Appointment)()

        Using conn As DbConnection = OpenConnection()
            Dim cmd As DbCommand = DbFactory.CreateCommand()
            cmd.Connection = conn
            cmd.CommandText = "SELECT [ClassID], [Subject], [Start], [End], [RecurrenceRule], [RecurrenceParentId], [Reminder], [Description], [AppointmentColor] FROM [DbProvider_Classes]"

            Using reader As DbDataReader = cmd.ExecuteReader()
                While reader.Read()
                    Dim apt As New Appointment()
                    'apt.Owner = owner;
                    apt.ID = reader("ClassID")
                    apt.Subject = Convert.ToString(reader("Subject"))
                    apt.Description = Convert.ToString(reader("Description"))
                    apt.Attributes("AppointmentColor") = Convert.ToString(reader("AppointmentColor"))
                    apt.Start = DateTime.SpecifyKind(Convert.ToDateTime(reader("Start")), DateTimeKind.Utc)
                    apt.[End] = DateTime.SpecifyKind(Convert.ToDateTime(reader("End")), DateTimeKind.Utc)
                    apt.RecurrenceRule = Convert.ToString(reader("RecurrenceRule"))
                    apt.RecurrenceParentID = If(reader("RecurrenceParentId") Is DBNull.Value, Nothing, reader("RecurrenceParentId"))

                    If Not reader("Reminder") Is DBNull.Value Then
                        Dim reminders As IList(Of Reminder) = Reminder.TryParse(Convert.ToString(reader("Reminder")))
                        If reminders IsNot Nothing Then
                            apt.Reminders.AddRange(reminders)
                        End If
                    End If

                    If apt.RecurrenceParentID IsNot Nothing Then
                        apt.RecurrenceState = RecurrenceState.Exception
                    ElseIf apt.RecurrenceRule <> String.Empty Then
                        apt.RecurrenceState = RecurrenceState.Master
                    End If

                    'LoadResources(apt)
                    appointments.Add(apt)
                End While
            End Using
        End Using

        Return appointments
    End Function
End Class


Thanks,
Dhamu.
0
Peter
Telerik team
answered on 22 Feb 2012, 03:43 PM
Hi,

I have noticed that you have set SelectedDate="2012-02-15", so maybe there are no appointments for that day. Could you please try inserting new appointments and then refreshing the page to see if they persist?

Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Dhamodharan
Top achievements
Rank 1
answered on 23 Feb 2012, 08:25 AM
Hi Peter,

I have record for this month SelectedDate="2012-02-15". i think it is not a problem. Please check my code and let me know.

Thanks,
Dhamu.
Tags
Scheduler
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Dhamodharan
Top achievements
Rank 1
Share this question
or