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

RadScheduler in usercontrol

10 Answers 155 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jason Li
Top achievements
Rank 1
Jason Li asked on 07 May 2012, 08:41 AM
Hi,

Just tried to put a simple RadScheduler with webservice binding in an usercontrol, but get a javascript error when loading the page. the error says "The server method 'GetAppointments' failed." the "OnClientRequestFailed" is fired as well. If I put the same radscheduler control directly in a aspx page, it works fine. Is there any specific settings for such scenario?  Thanks in advance.

ascx code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Scheduler.ascx.cs" Inherits="Usercontrols_Scheduler" %>
 
<telerik:RadScheduler ID="RadScheduler1" runat="server"AppointmentStyleMode="Default"
    SelectedView="WeekView" Width="100%" Height="100%" Culture="en-AU" WeekView-HeaderDateFormat="d/MM/yyyy"
    TimelineView-HeaderDateFormat="d/MM/yyyy" TimelineView-ColumnHeaderDateFormat="ddd d/MM"
    AdvancedForm-ZIndex="7002">
    <AdvancedForm Modal="true" />
    <TimelineView NumberOfSlots="7" />
    <WebServiceSettings Path="../SchedulerWebService.asmx" ResourcePopulationMode="ServerSide" />
</telerik:RadScheduler>

aspx page (parent page):
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="Forms_MasterData_test" %>
 
<%@ Register Src="../../Usercontrols/Scheduler.ascx" TagName="Scheduler" TagPrefix="uc1" %>
<!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 runat="server" ID="RadScriptManager1">
    </telerik:RadScriptManager>
    <div>
        <uc1:Scheduler ID="Scheduler1" runat="server" />
    </div>
    </form>
</body>
</html>


10 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 09 May 2012, 10:43 AM
Hi Jason,

 
It looks like the path in the WebService settings needs to be changed as well when you move the code to the user control.

Hope this will help you.

Kind regards,
Plamen Zdravkov
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
Jason Li
Top achievements
Rank 1
answered on 10 May 2012, 12:37 AM
Thanks Plamen.  But I did change the webservice path when use it in the user control. Otherwise it will cause a server error.  
0
Plamen
Telerik team
answered on 14 May 2012, 08:53 AM
Hi Jason,

 
I am attaching a sample project that implements a RadScheduler within a user control that is bound to WebService that worked properly at my side. Please review it and if you still observe the unusual behavior please let me know what other code should I add to the project in order to reproduce it locally.

Hope this will be helpful.

Kind regards,
Plamen Zdravkov
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
Jason Li
Top achievements
Rank 1
answered on 25 Jun 2012, 05:55 AM
Hi Plamen,

Thanks for the sample and sorry for the late reply. I found the error only happens when using the user control in pages located in customer sub folders, in your sample, I added a page to wetsite\Forms\MasterData path, and the same error just pops up. Please find the attached screen shots.

Thanks in advance,

Jason
0
Plamen
Telerik team
answered on 28 Jun 2012, 08:28 AM
Hello Jason,

 
It seems that this behavior appears when you set the path to the WebService method in the UserControl that is in another directory. In order to prevent this I will recommend you to move the UserControl in the MasterData folder as shown here as well and change the reference:

<%@ Register src="~/Forms/MatserData/SchedulerControl.ascx" tagname="SchedulerControl" tagprefix="uc1" %>

Hope this will be helpful.

All the best,
Plamen Zdravkov
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
Jason Li
Top achievements
Rank 1
answered on 28 Jun 2012, 11:41 PM
Thanks Plamen.

What is the root cause for the issue? how to use the same user control for pages in other folders? 

Regards,

Jason
0
Plamen
Telerik team
answered on 03 Jul 2012, 10:04 AM
Hi Jason,

 
It seems that when you put your user Controls in another directories and when the WebService method is called it can not be found because different path is generated which is confusing the functionality.

Hope this will explain the issue.

All the best,
Plamen Zdravkov
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
Jason Li
Top achievements
Rank 1
answered on 04 Jul 2012, 06:53 AM
Hi Plamen,

The common practice is to place user controls in a folder and use them in any pages from any folders. the suggested workaround to put the user control in the page folder means the same user control will need to be copied to all directories which containing pages with the uc registered. is this a known bug in the current release?

Regards,

Jason 
0
Accepted
Plamen
Telerik team
answered on 04 Jul 2012, 03:57 PM
Hi Jason,

 
It seems that I have made a mistake while inspecting the issue. Please excuse me for this confusion. I am attaching the sample project that uses the RadScheduler as a user control as in the image attached in the post from 25 of June.

Hope this will solve the issue.

Greetings,
Plamen Zdravkov
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
Jason Li
Top achievements
Rank 1
answered on 09 Jul 2012, 12:30 AM
Thanks very much Plamen, changing the web service URL to "~\...." fixes the issue.
Tags
Scheduler
Asked by
Jason Li
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Jason Li
Top achievements
Rank 1
Share this question
or