RadScheduler in usercontrol

11 posts, 1 answers
  1. Jason Li
    Jason  Li avatar
    17 posts
    Member since:
    Apr 2010

    Posted 07 May 2012 Link to this post

    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>


  2. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 09 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jason Li
    Jason  Li avatar
    17 posts
    Member since:
    Apr 2010

    Posted 09 May 2012 Link to this post

    Thanks Plamen.  But I did change the webservice path when use it in the user control. Otherwise it will cause a server error.  
  5. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 14 May 2012 Link to this post

    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.
  6. Jason Li
    Jason  Li avatar
    17 posts
    Member since:
    Apr 2010

    Posted 25 Jun 2012 Link to this post

    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
  7. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 28 Jun 2012 Link to this post

    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.
  8. Jason Li
    Jason  Li avatar
    17 posts
    Member since:
    Apr 2010

    Posted 28 Jun 2012 Link to this post

    Thanks Plamen.

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

    Regards,

    Jason
  9. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 03 Jul 2012 Link to this post

    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.
  10. Jason Li
    Jason  Li avatar
    17 posts
    Member since:
    Apr 2010

    Posted 04 Jul 2012 Link to this post

    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 
  11. Answer
    Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 04 Jul 2012 Link to this post

    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.
  12. Jason Li
    Jason  Li avatar
    17 posts
    Member since:
    Apr 2010

    Posted 08 Jul 2012 Link to this post

    Thanks very much Plamen, changing the web service URL to "~\...." fixes the issue.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017