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

RadScheduler WCF demo

9 Answers 262 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 05 May 2011, 11:18 PM

Hello.

I am trying to reproduce the demo application available at
http://demos.telerik.com/aspnet-ajax/scheduler/examples/wcf/defaultcs.aspx.

Using Visual Studio 2008, I have created a web application with components RadScriptManager and RadScheduler:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication6._Default" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      
    </div>
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
    </telerik:RadScriptManager>
    <telerik:RadScheduler ID="RadScheduler1" runat="server"> <WebServiceSettings Path="~/App_Code/SchedulerWcfService.svc" ResourcePopulationMode="ServerSide" />
    </telerik:RadScheduler>
    </form>
</body>
</html>

An AJAX-enabled WCF service was added to the solution:
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Web;
using Telerik.Web.UI;
  
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
  
public class SchedulerWcfService
{
    private WebServiceAppointmentController _controller;
  
    private WebServiceAppointmentController Controller
    {
        get
        {
            if (_controller == null)
            {
                _controller =
                    new WebServiceAppointmentController(
                        new XmlSchedulerProvider(HttpContext.Current.Server.MapPath("~/App_Data/Appointments_Outlook.xml"),
                            false));
            }
            return _controller;
        }
    }
  
    [OperationContract]
    public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)
    {
        return Controller.GetAppointments(schedulerInfo);
    }
  
    [OperationContract]
    public IEnumerable<AppointmentData> InsertAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
    {
        return Controller.InsertAppointment(schedulerInfo, appointmentData);
    }
  
    [OperationContract]
    public IEnumerable<AppointmentData> UpdateAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)
    {
        return Controller.UpdateAppointment(schedulerInfo, appointmentData);
    }
  
    [OperationContract]
    public IEnumerable<AppointmentData> CreateRecurrenceException(SchedulerInfo schedulerInfo,
     AppointmentData recurrenceExceptionData)
    {
        return Controller.CreateRecurrenceException(schedulerInfo, recurrenceExceptionData);
    }
  
    [OperationContract]
    public IEnumerable<AppointmentData> RemoveRecurrenceExceptions(SchedulerInfo schedulerInfo,
     AppointmentData masterAppointmentData)
    {
        return Controller.RemoveRecurrenceExceptions(schedulerInfo, masterAppointmentData);
    }
  
    [OperationContract]
    public IEnumerable<AppointmentData> DeleteAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData,
     bool deleteSeries)
    {
        return Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries);
    }
  
    [OperationContract]
    public IEnumerable<ResourceData> GetResources(SchedulerInfo schedulerInfo)
    {
        return Controller.GetResources(schedulerInfo);
    }
  
}

Since data is retrieved from file Appointments_Outlook.xml, the file was copied from C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q3 2010\Live Demos\App_Data to directory App_Data of the web application.

The following section was automatically added to web.config:

<system.serviceModel>
    <behaviors>
        <endpointBehaviors>
            <behavior name="WebApplication6.App_Code.SchedulerWcfServiceAspNetAjaxBehavior">
                <enableWebScript />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
        <service name="WebApplication6.App_Code.SchedulerWcfService">
            <endpoint address="" behaviorConfiguration="WebApplication6.App_Code.SchedulerWcfServiceAspNetAjaxBehavior"
                binding="webHttpBinding" contract="WebApplication6.App_Code.SchedulerWcfService" />
        </service>
    </services>
</system.serviceModel>

When I launch the application, the following error message is displayed:
Server Error in '/' Application.
--------------------------------------------------------------------------------
  
The remote server returned an error: (403) Forbidden. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden.
  
Source Error: 
  
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
  
Stack Trace: 
  
[WebException: The remote server returned an error: (403) Forbidden.]
   System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) +302
   System.Net.WebClient.UploadString(Uri address, String method, String data) +170
   System.Net.WebClient.UploadString(String address, String method, String data) +35
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +471
  
[Exception: An error occurred while requesting resources from the web service. Server responded with: <html>
    <head>
        <title>Forbidden</title>
        <style>
            body {font-family:"Verdana";font-weight:normal;font-size: 8pt;color:black;} 
            p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
            b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
            h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
            h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
            pre {font-family:"Lucida Console";font-size: 8pt}
            .marker {font-weight: bold; color: black;text-decoration: none;}
            .version {color: gray;}
            .error {margin-bottom: 10px;}
            .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
        </style>
    </head>
    <body bgcolor="white">
  
            <span><h1>Server Error in '/' Application.<hr width=100% size=1 color=silver></h1>
  
            <h2> <i>HTTP Error 403 - Forbidden.</i> </h2></span>
  
            <hr width=100% size=1 color=silver>
  
            <b>Version Information:</b> ASP.NET Development Server 9.0.0.0
  
            </font>
  
    </body>
</html>
]
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +633
   Telerik.Web.UI.RadScheduler.BindResourcesFromWebService() +95
   Telerik.Web.UI.RadScheduler.BindResources() +50
   Telerik.Web.UI.RadScheduler.PerformSelect() +88
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.RadScheduler.EnsureDataBound() +51
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +63
   Telerik.Web.UI.RadScheduler.CreateChildControls() +10
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
  
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3618 


I would appreciate whether you could provide some assistance to solve the problem.
Thank you in advance.

Paulo

9 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 06 May 2011, 11:50 AM
Hi Paulo,

I've created a sample project to demonstrate how to bind the RadScheduler to WCF Service in two ways:

1) With the help of XmlProvider - same as our online demo:

private WebServiceAppointmentController _controller;
private WebServiceAppointmentController Controller
{
    get
    {
        if (_controller == null)
        {
            _controller =
                new WebServiceAppointmentController(
                    new XmlSchedulerProvider(HttpContext.Current.Server.MapPath("~/App_Data/Appointments_Outlook.xml"),
                        false));
        }
        return _controller;
    }
}

2) Via Database Provider:

private WebServiceAppointmentController _controller;
   private MyDbSchedulerProvider _provider;
   private MyDbSchedulerProvider Provider
   {
       get
       {
           if (_provider == null)
           {
               var connString = ConfigurationManager.ConnectionStrings["TelerikVSXConnectionString"].ConnectionString;
               var factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
               _provider = new MyDbSchedulerProvider() { ConnectionString = connString, DbFactory = factory, PersistChanges = true };
           }
           return _provider;
       }
   }

Please take a look at the attached .zip file where you can find the demo project.

Feel free to ask me if you have further questions.

Kind regards,
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.

0
Paulo
Top achievements
Rank 1
answered on 13 May 2011, 12:22 AM

Hello, Veronica.

Thank you very much for your reply.

Few days ago, I was able to test the sample Database Provider project you created.
However, I have just tried to launch it again and it failed:

Server Error in '/' Application.
--------------------------------------------------------------------------------
  
The remote server returned an error: (404) Not Found. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
Exception Details: System.Net.WebException: The remote server returned an error: (404) Not Found.
  
Source Error: 
  
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
  
Stack Trace: 
  
[WebException: The remote server returned an error: (404) Not Found.]
   System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) +302
   System.Net.WebClient.UploadString(Uri address, String method, String data) +170
   System.Net.WebClient.UploadString(String address, String method, String data) +35
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +471
  
[Exception: An error occurred while requesting resources from the web service. Server responded with: ]
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +633
   Telerik.Web.UI.RadScheduler.BindResourcesFromWebService() +95
   Telerik.Web.UI.RadScheduler.BindResources() +50
   Telerik.Web.UI.RadScheduler.PerformSelect() +88
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.RadScheduler.EnsureDataBound() +51
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +63
   Telerik.Web.UI.RadScheduler.CreateChildControls() +10
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

I have checked the service model configuration in web.config and noticed a reference to http://api.hisoftware.com/Service.svc as the address of an endpoint. I have tried to access the url, but the browser returned a message stating that the page could not be displayed.

I was wondering if that's the reason for the failure on the Database Provider project.
Could you please confirm the problem and provide a possible solution?

Thank you again for your assistance.
Paulo
0
Veronica
Telerik team
answered on 17 May 2011, 10:58 AM
Hi Paulo,

I've tested the project many times but I haven't received any errors. I am interested whether you've changed anything to the code. If yes - could you please show me the changes?

As for the http://api.hisoftware.com/Service.svc  - I've changed our demo for WCF binding and I've used the web.config file of our online demos. Starting from Q3 2010, RadEditor for ASP.NET AJAX offers a new Compliance Check Dialog (CSDialog) to verify the editor content. The compliance check dialog is developed by HiSoftware and integrates with their Compliance Sheriff product. So this url and the endpoint comes form the editor's settings in the web.config file and has no relationship to your problem.

Regards,
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.

0
Paulo
Top achievements
Rank 1
answered on 17 May 2011, 08:20 PM

Hello, Veronica.

>I am interested whether you've changed anything to the code. If yes - could you please show me the changes?
No, unfortunately I have not made any changes.

Instead of trying to figure out why the project stopped working, I have started a brand new one using your project as a template.
The main goal is to implement an AJAX-enabled web service that returns a list of appointments, which will then populate the controller radScheduler.

In the main page of the new project (default.aspx), there are two buttons and a text box:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <script language="javascript" type="text/javascript">
        function getReservations() 
        {
            Services.Service1.ReadReservationItem1(201, "PERS TRAINING", "04/01/2011", "L", '', onMethodCompleted);
        }
  
        function onMethodCompleted(results) 
        {
            var aux = '';
  
            for (var i = 0; i < results.length; i++) 
            {
                aux = aux + "item " + (i + 1).toString() + "\r" +
                            "Reservation id: " + results[i].ReservationId.toString() + "\r" +
                            "Resource: " + results[i].Resource + "\r" +
                            "Quantity on hand: " + results[i].QOH.toString() + "\r" +
                            "Limit: " + results[i].Limit.toString() + "\r" +
                            "Start Time: " + results[i].StartTime + "\r" +
                            "Units: " + results[i].Units.toString() + "\r" +
                            "Description: " + results[i].InventoryDescription + "\r" +
                            "Associate membership number: " + results[i].AssociateMembershipNbr + "\r" +
                            "Remaining sessions: " + results[i].RemainingSessions.toString() + "\r" +
                            "Recurring: " + results[i].Recurring + "\r\r";
            }
            $get("txtReservations").innerText = "Reservations\r\r" + aux;
        }
  
        function getReservationsTelerik() 
        {
            alert("before");
            Services.Service1.ReadReservationItem1Telerik(201, "PERS TRAINING", "04/01/2011", "L", '', onMethodCompletedTelerik, onMethodFailedTelerik);
            alert("after");
        }
  
        function onMethodFailedTelerik() 
        {
            alert("error");
        }
  
        function onMethodCompletedTelerik(results) 
        {
            var aux = '';
  
            for (var i = 0; i < results.length; i++) 
            {
                alert(i.toString());
                aux = aux + "item " + (i + 1).toString() + "\r" +
                            "Id: " + results[i].ID.toString() + "\r" +
                            "Subject: " + results[i].Subject + "\r" +
                            "Start: " + results[i].Start.toString() + "\r" +
                            "End: " + results[i].End.toString() + "\r\r";
            }
            aux = results.length.toString();
            $get("txtReservations").innerText = "Telerik Reservations\r\r" + aux;
        }
    </script>
      
    <form id="form1" runat="server">
    <div>
      
    </div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Services>
            <asp:ServiceReference Path="~/Service1.svc" />
        </Services>
    </asp:ScriptManager>
      
    <h1>Reservations</h1>
    <input type="button" value="Get reservations" onclick="getReservations()" />
    <input type="button" value="Get Telerik reservations" onclick="getReservationsTelerik()" />
    <hr />
    <asp:TextBox TextMode="MultiLine" runat="server" ID="txtReservations" Columns="100" Rows="30"></asp:TextBox>
    </form>
</body>
</html>

When button "Get reservations" is clicked, function getReservations is called, which then calls the AJAX-enabled web service method ReadReservationItem1.
Method ReadReservationItem1 calls stored procedure procReservationListSelect.
Function onMethodCompleted fills the text box with the result of method ReadReservationItem1.

Everything works.

Here is the web service implementation:

using System;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Configuration;
using System.Transactions;
using System.Collections.Generic;
using IBM.Data.DB2;
using Telerik.Web.UI;
  
namespace WebApplication1
{
    [ServiceContract(Namespace = "Services")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class Service1
    {
        private DB2Connection m_connection;
        private DB2Command m_cmdReservationListSelect;
  
        public Service1()
        {
            m_connection = new DB2Connection(ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
            m_cmdReservationListSelect = new DB2Command("procReservationListSelect");
            m_cmdReservationListSelect.CommandType = System.Data.CommandType.StoredProcedure;
            m_cmdReservationListSelect.Connection = m_connection;
            m_cmdReservationListSelect.Parameters.Add(new DB2Parameter("parClubId", DB2Type.SmallInt));
            m_cmdReservationListSelect.Parameters.Add(new DB2Parameter("parResourceType", DB2Type.Char, 15));
            m_cmdReservationListSelect.Parameters.Add(new DB2Parameter("parReservationDate", DB2Type.Char, 10));
            m_cmdReservationListSelect.Parameters.Add(new DB2Parameter("parReservationType", DB2Type.Char, 1));
            m_cmdReservationListSelect.Parameters.Add(new DB2Parameter("parMembershipNbr", DB2Type.Char, 10));
        }
  
        [OperationContract]
        public List<ReservationItem1> ReadReservationItem1(Int16 clubId, String resourceType, String reservationDate, String reservationType, String membershipNbr)
        {
            List<ReservationItem1> items = null;     
            using (TransactionScope scope = new TransactionScope())
            {
                m_cmdReservationListSelect.Parameters["parClubId"].Value = clubId;
                m_cmdReservationListSelect.Parameters["parResourceType"].Value = resourceType;
                m_cmdReservationListSelect.Parameters["parReservationDate"].Value = reservationDate;
                m_cmdReservationListSelect.Parameters["parReservationType"].Value = reservationType;
                m_cmdReservationListSelect.Parameters["parMembershipNbr"].Value = membershipNbr;
  
                m_connection.Open();
  
                using (DB2DataReader reader = m_cmdReservationListSelect.ExecuteReader())
                {
                    items = new List<ReservationItem1>();
                    if (reader.HasRows)
                    {
                        int resource = reader.GetOrdinal("resource");
                        int reservation = reader.GetOrdinal("reservation");
                        int qoh = reader.GetOrdinal("qoh");
                        int limit = reader.GetOrdinal("limit");
                        int start_time = reader.GetOrdinal("start_time");
                        int res_units = reader.GetOrdinal("res_units");
                        int invtr_desc = reader.GetOrdinal("invtr_desc");
                        int trainer_cust_code = reader.GetOrdinal("trainer_cust_code");
                        int remaining_sessions = reader.GetOrdinal("remaining_sessions");
                        int recurring = reader.GetOrdinal("recurring");
  
                        while (reader.Read())
                        {
                            ReservationItem1 item = new ReservationItem1();
                            item.Resource = (!reader.IsDBNull(resource) ? reader.GetString(resource) : "");
                            item.ReservationId = (!reader.IsDBNull(reservation) ? reader.GetInt32(reservation) : 0);
                            item.QOH = (!reader.IsDBNull(qoh) ? reader.GetInt16(qoh) : 0);
                            item.Limit = (!reader.IsDBNull(limit) ? reader.GetInt16(limit) : 0);
                            item.StartTime = (!reader.IsDBNull(start_time) ? reader.GetString(start_time) : "");
                            item.Units = (!reader.IsDBNull(res_units) ? reader.GetInt16(res_units) : 0);
                            item.InventoryDescription = (!reader.IsDBNull(invtr_desc) ? reader.GetString(invtr_desc) : "");
                            item.AssociateMembershipNbr = (!reader.IsDBNull(trainer_cust_code) ? reader.GetString(trainer_cust_code) : "");
                            item.RemainingSessions = (!reader.IsDBNull(remaining_sessions) ? reader.GetInt16(remaining_sessions) : 0);
                            item.Recurring = (!reader.IsDBNull(recurring) ? reader.GetString(recurring) : "");
                            items.Add(item);
                        }
                    }
                }
                m_connection.Close();
                scope.Complete();
                return items;
            }
        }
  
        [OperationContract]
        public List<Appointment> ReadReservationItem1Telerik(Int16 clubId, String resourceType, String reservationDate, String reservationType, String membershipNbr)
        {
            List<Appointment> appointments = new List<Appointment>();
  
            using (TransactionScope scope = new TransactionScope())
            {
                m_cmdReservationListSelect.Parameters["parClubId"].Value = clubId;
                m_cmdReservationListSelect.Parameters["parResourceType"].Value = resourceType;
                m_cmdReservationListSelect.Parameters["parReservationDate"].Value = reservationDate;
                m_cmdReservationListSelect.Parameters["parReservationType"].Value = reservationType;
                m_cmdReservationListSelect.Parameters["parMembershipNbr"].Value = membershipNbr;
  
                m_connection.Open();
  
                using (DB2DataReader reader = m_cmdReservationListSelect.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        int resource = reader.GetOrdinal("resource");
                        int reservation = reader.GetOrdinal("reservation");
                        int qoh = reader.GetOrdinal("qoh");
                        int limit = reader.GetOrdinal("limit");
                        int start_time = reader.GetOrdinal("start_time");
                        int res_units = reader.GetOrdinal("res_units");
                        int invtr_desc = reader.GetOrdinal("invtr_desc");
                        int trainer_cust_code = reader.GetOrdinal("trainer_cust_code");
                        int remaining_sessions = reader.GetOrdinal("remaining_sessions");
                        int recurring = reader.GetOrdinal("recurring");
  
                        while (reader.Read())
                        {
                            Appointment apt = new Appointment();
                            apt.ID = (!reader.IsDBNull(reservation) ? reader.GetInt32(reservation) : 0);
                            apt.Subject = (!reader.IsDBNull(invtr_desc) ? reader.GetString(invtr_desc) : "");
                            apt.Start = Convert.ToDateTime("04/01/2011 " + reader.GetString(start_time));
                            apt.End = Convert.ToDateTime("04/01/2011 " + reader.GetString(start_time)).AddHours(reader.GetInt16(res_units));
                            apt.RecurrenceRule = "";
                            apt.RecurrenceParentID = null;
                            appointments.Add(apt);
                        }
                    }
                }
                m_connection.Close();
                scope.Complete();
                return appointments;
            }
        }
    }
}

And here is the implementation of class ReservationItem1:

using System;
using System.Runtime.Serialization;
  
namespace WebApplication1
{
    public class ReservationItem1
    {
        [DataMember(Name = "Resource", IsRequired = false, Order = 0)]
        private String m_resource;
        [DataMember(Name = "ReservationId", IsRequired = false, Order = 1)]
        private Int32 m_reservation;
        [DataMember(Name = "QOH", IsRequired = false, Order = 2)]
        private Int32 m_qoh;
        [DataMember(Name = "Limit", IsRequired = false, Order = 3)]
        private Int32 m_limit;
        [DataMember(Name = "StartTime", IsRequired = false, Order = 4)]
        private String m_start_time;
        [DataMember(Name = "Units", IsRequired = false, Order = 5)]
        private Int32 m_res_units;
        [DataMember(Name = "InventoryDescription", IsRequired = false, Order = 6)]
        private String m_invtr_desc;
        [DataMember(Name = "AssociateMembershipNbr", IsRequired = false, Order = 7)]
        private String m_trainer_cust_code;
        [DataMember(Name = "RemainingSessions", IsRequired = false, Order = 8)]
        private Int32 m_remaining_sessions;
        [DataMember(Name = "Recurring", IsRequired = false, Order = 9)]
        private String m_recurring;
  
        public String Resource
        {
            get { return m_resource; }
            set { m_resource = value; }
        }
        public Int32 ReservationId
        {
            get { return m_reservation; }
            set { m_reservation = value; }
        }
  
        public Int32 QOH
        {
            get { return m_qoh; }
            set { m_qoh = value; }
        }
  
        public Int32 Limit
        {
            get { return m_limit; }
            set { m_limit = value; }
        }
  
        public String StartTime
        {
            get { return m_start_time; }
            set { m_start_time = value; }
        }
  
        public Int32 Units
        {
            get { return m_res_units; }
            set { m_res_units = value; }
        }
  
        public String InventoryDescription
        {
            get { return m_invtr_desc; }
            set { m_invtr_desc = value; }
        }
  
        public String AssociateMembershipNbr
        {
            get { return m_trainer_cust_code; }
            set { m_trainer_cust_code = value; }
        }
  
        public Int32 RemainingSessions
        {
            get { return m_remaining_sessions; }
            set { m_remaining_sessions = value; }
        }
  
        public String Recurring
        {
            get { return m_recurring; }
            set { m_recurring = value; }
        }
    }
}

When button "Get Telerik reservations" is clicked, function getReservationsTelerik is called, which then calls the AJAX-enabled web service method ReadReservationItem1Telerik.

Method ReadReservationItem1Telerik calls stored procedure procReservationListSelect.

I have debugged ReadReservationItem1Telerik and confirmed the local variable "appointments" is populated accordingly.

The problem happens after that, when the text box is supposed to be populated by function onMethodCompletedTelerik. After adding some debug messages via the Javascript function alert, I have realized function onMethodFailedTelerik is being called instead.

Is there any additional step in order to pass a list of Telerik "appointments" back to the web page?
Am I missing something?


Thank you again for your assistance.
Paulo

 

0
Veronica
Telerik team
answered on 26 May 2011, 08:08 AM
Hi Paulo,

Thank you for the detailed explanation as well as the code provided.

Could you please open a new support thread and attach your latest project there. That way I can debug it and be able to advice you.

Thank you!

Regards,
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.

0
Tim
Top achievements
Rank 1
answered on 16 Nov 2011, 06:14 PM
Hi Veronica, I'm trying to get the WCF example you put on this post working. I've downloaded the WCF.zip file and unzipped it to a directory. Didn't make any changes to it. Just tried to run it from VS 2010 and I get the following error. I'm getting the same error with other examples I've tried to implement.

Any ideas?

Thanks,

Tim

[WebException: The remote server returned an error: (500) Internal Server Error.]
   System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +290
   System.Net.WebClient.DownloadString(Uri address) +106
   System.Net.WebClient.DownloadString(String address) +29
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +451
  
[Exception: An error occurred while requesting resources from the web service. Server responded with: {"ExceptionDetail":{"HelpLink":null,"InnerException":null,"Message":"Object reference not set to an instance of an object.","StackTrace":"   at SchedulerWcfService.get_Provider()\u000d\u000a   at SchedulerWcfService.get_Controller()\u000d\u000a   at SyncInvokeGetResources(Object , Object[] , Object[] )\u000d\u000a   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)\u000d\u000a   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)","Type":"System.NullReferenceException"},"ExceptionType":"System.NullReferenceException","Message":"Object reference not set to an instance of an object.","StackTrace":"   at SchedulerWcfService.get_Provider()\u000d\u000a   at SchedulerWcfService.get_Controller()\u000d\u000a   at SyncInvokeGetResources(Object , Object[] , Object[] )\u000d\u000a   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)\u000d\u000a   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)\u000d\u000a   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)"}]
   Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +679
   Telerik.Web.UI.RadScheduler.BindResourcesFromWebService() +89
   Telerik.Web.UI.RadScheduler.BindResources() +50
   Telerik.Web.UI.RadScheduler.PerformSelect() +89
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   Telerik.Web.UI.RadScheduler.EnsureDataBound() +56
   Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +63
   Telerik.Web.UI.RadScheduler.CreateChildControls() +10
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
0
Tim
Top achievements
Rank 1
answered on 16 Nov 2011, 06:35 PM
Hi, I got this working. Needed to use the XML provider and point it to the Appointments_Outlook.xml file in App_Data.

private WebServiceAppointmentController Controller
{
    get
    {
        if (_controller == null)
        {
           // _controller = new WebServiceAppointmentController(Provider);
            _controller =
                new WebServiceAppointmentController(
                    new XmlSchedulerProvider(HttpContext.Current.Server.MapPath("~/App_Data/Appointments_Outlook.xml"),
                        false)); 
        }
        return _controller;
    }
}
0
Peter
Telerik team
answered on 17 Nov 2011, 02:19 PM
Hi Tim,

Glad to hear you resolved the problem. Thanks for sharing your findings in the forum.

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
Brendan
Top achievements
Rank 1
answered on 22 Oct 2018, 03:51 AM
noice
Tags
Scheduler
Asked by
Paulo
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Paulo
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Peter
Telerik team
Brendan
Top achievements
Rank 1
Share this question
or