Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Scheduler > RadScheduler Web Service Binding Filter Resource Issue

Not answered RadScheduler Web Service Binding Filter Resource Issue

Feed from this thread
  • Michael avatar

    Posted on Jan 13, 2011 (permalink)

    I am using web service binding for imporving RadScheduler performance.

    But I want to enable filter resources just like server-side demo (http://demos.telerik.com/aspnet-ajax/scheduler/examples/resources/defaultcs.aspx)

    Could this requirement be done by client-side programming?

                var scheduler = $find('CalendarControl1_RadScheduler1');
                var apts = scheduler.get_appointments();
                var recs = scheduler.get_resources();
                var aptsByRec = apts.findByResource(recs.getResourceByTypeAndKey("User""Michael"));
                scheduler.set_appointments(aptsByRec); //Error Here;
    Thanks & forgive my poor English

    Reply

  • Veronica Veronica admin's avatar

    Posted on Jan 19, 2011 (permalink)

    Hi Michael,

    Please accept my apologies for the late reply.

    I created a sample project for you. Please find it in the attached .zip file and let me know if you have further questions.

    Best wishes,
    Veronica Milcheva
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
    Attached files

    Reply

  • dhamodharan Intermediate avatar

    Posted on Feb 6, 2012 (permalink)

    Hi Veronica,

    Your code working fine. but i want to display in AdvancedinsertTemplate. please give me a sample for AdvancedinsertTemplate. please let me know ASAP.



    <AdvancedInsertTemplate>
    <div class="rsAdvancedEdit rsAdvancedModal" id="divAdvanced" runat="server">
    <div class="rsModalBgTopLeft">
    </div>
    <div class="rsModalBgTopRight">
    </div>
    <div class="rsModalBgBottomLeft">
    </div>
    <div class="rsModalBgBottomRight">
    </div>
    <div class="rsAdvTitle">
    <h1 class="rsAdvInnerTitle">
    <asp:Label ID="lblSportText" runat="server" SkinID="NoBold"></asp:Label></h1>
    <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose"
    CommandName="Cancel" CausesValidation="false" ToolTip='<%# Container.Appointment.Owner.Localization.AdvancedClose %>'>
    <%# Container.Appointment.Owner.Localization.AdvancedClose%>
    </asp:LinkButton>
    </div>
    <div class="rsAdvContentWrapper">
    <table style="padding-left: 10px">
    <tr>
    <td style="padding-left: 5px; vertical-align: middle">
    <asp:Label ID="lblSport" runat="server" Text="Sport " SkinID="NoBold"></asp:Label>
    </td>
    <td style="padding-left: 5px;">
    <telerik:RadComboBox ID="rcbSport" runat="server" Width="213px"
    AppendDataBoundItems="true"
    AutoPostBack="false"
    DataTextField="description" DataValueField="sport_id">
    <Items>
    <telerik:RadComboBoxItem Text="Select" Value="0" Selected="true" />
    <telerik:RadComboBoxItem Text="Foot Ball" Value="1" Selected="true" />
    <telerik:RadComboBoxItem Text="Basket Ball" Value="2" Selected="true" />
    </Items>
    </telerik:RadComboBox>
    </td>
    </tr>
    <tr>
    <td style="padding-left: 5px; padding-top: 2px; height: 45px">
    <asp:Label ID="lblNotes" runat="server" Text="Notes " SkinID="NoBold"></asp:Label>
    </td>
    <td style="padding-left: 4px; padding-top: 2px;" colspan="3">
    <telerik:RadTextBox ID="txtNotes" runat="server" Width="506px" TextMode="MultiLine"
    Height="40px">
    </telerik:RadTextBox>
    </td>
    </tr>
    <tr>
    <td colspan="4" style="height: 50px;" align="center">
    <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea" Style="text-align: center">
    <div style="text-align: center; padding-top: 7px">
    <table style="text-align: center; padding-top: 7px">
    <tr>
    <td>
    <asp:LinkButton CommandName="Update" runat="server" ID="UpdateButton" ValidationGroup="ValidateSportEvent"
    CausesValidation="true">
    <asp:Image ID="imgSave" runat="server" />
    </asp:LinkButton>
    </td>
    <td>
    &nbsp;
    </td>
    <td>
    <asp:LinkButton runat="server" ID="CancelButton" CommandName="Cancel" CausesValidation="false">
    <asp:Image ID="imgCancel" runat="server" Style="padding-left: 0" />
    </asp:LinkButton>
    </td>
    </tr>
    </table>
    </div>
    </asp:Panel>
    </td>
    </tr>
    </table>
    </div>
    </div>
    </AdvancedInsertTemplate>

    Thanks,
    Dhamu

    Reply

  • dhamodharan Intermediate avatar

    Posted on Feb 8, 2012 (permalink)

    Hi, 

    Any idea?.......

    Thanks
    Dhamu.

    Reply

  • Plamen Zdravkov Plamen Zdravkov admin's avatar

    Posted on Feb 13, 2012 (permalink)

    Hi Dhamu,

     
    You can refer to this Code Library where is shown how to customize the advanced form when using WebService binding.

    You can also take a look at the Filter Appointments by sending additional information to the WebService article.

    Hope this will be helpful.

    All the best,
    Plamen Zdravkov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • dhamodharan Intermediate avatar

    Posted on Feb 20, 2012 (permalink)

    Hi Plamen Zdravkov,

    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. 

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Scheduler > RadScheduler Web Service Binding Filter Resource Issue
Related resources for "RadScheduler Web Service Binding Filter Resource Issue"

ASP.NET Scheduler Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial ]