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

RadScheduler in RenderPartial

4 Answers 141 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Brian Smith
Top achievements
Rank 1
Brian Smith asked on 28 Oct 2009, 08:39 AM
These might be a simple answers, however, getting to the question has been a tough road.

1. Like a few other AJAX controls, is RadScheduler not yet supported via a RenderPartial? I can successfully load the control in a regular view, however, with the same code and many alternate iterations, I can not successfully load it via RenderPartial. My intent is to load tab divs with renderpartial and the scheduler would be in one of those tabs.

2. I also have read I need to figure out how to post session variables via javascript in order to then access them in the provider class to include additional parameters - is this still the case?

And while I am at it...

3. Can I show an image in place of, or addition to,  the text of an appointment in the schedular view?

Even knowing the Yes/No to each of these questions will really help me refocus on how I implement the control.

Thanks much,
Brian

4 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 03 Nov 2009, 09:26 AM
Hello Brian,

Please, excuse me for the delayed reply.

You can render RadScheduler in partial view, but with some limitations:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<telerik:RadScheduler runat="server" ID="RadScheduler1" RegisterWithScriptManager="false">
    <WebServiceSettings Path="~/Models/SchedulerWebService.asmx" />
    <AdvancedForm Enabled="false" />
</telerik:RadScheduler>
 
<% RadScheduler1.SelectedDate = new DateTime(2009, 1, 1); %>
     
<telerik:RadScriptManager runat="server" ID="RadScriptManager1"></telerik:RadScriptManager>

The default advanced form must be disabled and you must also place RadScriptManager at the end of the user control as well.

The problem with the advanced form is that it contains LinkButtons which require a form. They don't postback in web service binding mode, as the events are captured by the client-side script. So, they can be replaced with HtmlLink elements, for example, and should continue to work as long as they have the same CSS class.

The standard advanced form is available as a set of user controls in this example:
http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx

The example uses server-side data binding, but the form itself works in Web Service mode as well.

The scheduler provider interface is still the same, so the session must be used to send additional data to the provider. This thread discusses how this can be done:
http://www.telerik.com/community/forums/aspnet-ajax/scheduler/sending-extra-info-to-the-web-service.aspx#789023

You can manipulate the appointment DOM elements in the client-side appointmentCreated event. Here's a quick example on how to add an image to the appointment:

function appointmentCreated(sender, eventArgs)
{
    var $ = $telerik.$; // jQuery alias
    var apt = eventArgs.get_appointment();
     
    $(".rsAptContent", apt.get_element())
        .append(
            $("<img src='someurl.gif' alt='some alt' style='width:16px;height:16px;'></img>")
        );
}

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Chad
Top achievements
Rank 1
answered on 21 Nov 2012, 11:51 PM
Hi Tsvetomir,

When I try to put the RadScheduler in a ViewUserControl as you outline I get errors that Sys is not defined. Any suggestions?

Thanks.
0
Plamen
Telerik team
answered on 26 Nov 2012, 03:04 PM
Hello Chad,

 
You can check this blog post where common reasons for the mentioned error have been provided.

Hope this will be helpful.

All the best,
Plamen
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
Chad
Top achievements
Rank 1
answered on 30 Nov 2012, 03:29 AM
Hi Plamen,

I have resolved the Sys not defined error and the RadScheduler seems to work in my partial view other than the Edit and Delete Context-menu Options don't seem to trigger and clicking the red x in the top corner of an appointment produces this error: TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'modal'
I had to add this script reference to my _Layout.cshtml file to get rid of the Sys error: 
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"></script>

Any suggestions on how to get this to work? Any working examples of a RadScheduler being used as a PartialView in a ASP.NET MVC Application?

Thanks.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Brian Smith
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Chad
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or