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

RadScheduler in ASPNET MVC

17 Answers 743 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Carlos Souto
Top achievements
Rank 1
Carlos Souto asked on 09 Jul 2009, 02:06 PM
Hi all!

I'm working in this ASPNET MVC project and i need to use a RadScheduler control.

As i found out in Telerik website the only way for it to work in MVC is to use WebServices and a SchedulerProvider.

We have set up a DbSchedulerProvider and a WebService based on the "WebServices" example of RadScheduler but we are facing some problems:

1. We cannot edit or delete the Appointment
2. We cannot see the delete icon

The markup we are using is as follows:

        <telerik:RadScriptManager runat="server" ID="RadScriptManager1"></telerik:RadScriptManager>
        
        <telerik:RadScheduler ID="RadScheduler1" runat="server"
            SelectedView="MonthView"
            SelectedDate="2009-02-02"
            TimeZoneOffset="03:00:00"
            StartEditingInAdvancedForm="false"
            ProviderName="SchedulerDataProvider"
            Culture="pt-PT"
            FirstDayOfWeek="Monday"
            LastDayOfWeek="Sunday">
            <AdvancedForm Modal="false" />
            <TimelineView GroupBy="Calendar" GroupingDirection="Vertical" />
            <WebServiceSettings Path="~/HoursMapValidation/HoursMap.asmx" ResourcePopulationMode="ServerSide" />
        </telerik:RadScheduler>

Notice that we had to use the ProviderName attribute to our Provider Name(SchedulerDataProvider) as declared in web.config.

What can cause this problem?

We are stuck with this for a couple of days now and we may have to use the ContextMenu if we cannot solve the problem in reasonable time.

Best Regards

17 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 09 Jul 2009, 03:20 PM
Hello,

We were unable to reproduce such problem. I'm attaching a test project here. Can you please open a support ticket and send me your project, so we can debug it?

Kind regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Carlos Souto
Top achievements
Rank 1
answered on 09 Jul 2009, 03:34 PM
Hello Tsvetomi.

And thanks for your quick reply.

Just after i posted this thread i tried to implement the ContextMenu and in the end BOTH are now working.

I cannot tell what was happening but happily all is working and my job is on track.

I will check against the demo project you kindly sent if i can see anything wrong.

Best Regards
0
Carlos Souto
Top achievements
Rank 1
answered on 09 Jul 2009, 04:28 PM
Hi again.

I could not find any substantial difference between the projects. Anyway, it's working and we're moving ahead.

I have one question though: How can i dinamically set the RadScheduler Date?

Best Regards

Carlos Souto


0
T. Tsonev
Telerik team
answered on 10 Jul 2009, 12:46 PM
Hello,

That's great news. Do you mean that you can't set the date by using a code block like this?
<% RadScheduler1.SelectedDate = new DateTime(2009, 1, 1); %>

This can happen when the script manager is placed before the control. The general guideline is that it should be placed after all controls or at the end of the master page.

Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Carlos Souto
Top achievements
Rank 1
answered on 10 Jul 2009, 03:34 PM
Hi Tsvetomir!

I have proceded as you said and all is working as needed.

This is the first time i work with Telerik controls and ASPNET MVC framework and i cant say it's a peace of cake but with some patiente and your help we are on our way.

Best Regards
0
gordon gordon
Top achievements
Rank 1
answered on 10 Sep 2009, 06:06 PM
Hello Tsvetomir. I'm trying out RadControls with asp .net mvc too and downloaded your project but it didn't work. I downloaded the newest version of RadControls tried compile the project then got errors so I go to Telerik > RadControls for ASP .net AJAX > upgrade wizard. Upgrade was succeed so I compiled and run project. The website will showed up but control doesn't get any data from webservice ( I debug it and it gets data from an xml file but it seems that control can't get it from webservice). I would be grateful if you could help me.

Thanks

Gordon
0
Atanas Korchev
Telerik team
answered on 11 Sep 2009, 07:44 AM
Hello gordon gordon,

I tested the attached project and it ran as expected at my side. I only had to update the reference to Telerik.Web.UI.dll and rebuild. That was all.

Regards,
Albert,
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
gordon gordon
Top achievements
Rank 1
answered on 11 Sep 2009, 02:04 PM
Thanks for fast reply ! I managed to fix my problem and appointments are loaded but I can't add new files to xml file or update current. However I've got another problem. I want to change source of appointment from xml to sql. So I used linq to sql and create dbml class and change code in webservice. Now my code looks like this:

 public class SchedulerWebService : System.Web.Services.WebService 
    { 
        private WebServiceAppointmentController _controller; 
        public const string ProviderSessionKey = "SchedulerWebServiceData"
        public XmlSchedulerProvider provider; 
        List<Event> ev; 
        List<Appointment> appList = new List<Appointment>(); 
 
        [WebMethod(EnableSession = true)] 
        public IEnumerable<Appointment> GetAppointments(SchedulerInfo schedulerinfo) 
        { 
            using (SchedulerDBDataContext db = new SchedulerDBDataContext()) 
            { 
                ev = db.Events.ToList(); 
 
                foreach (var i in ev) 
                { 
                    Appointment ap = new Appointment(i.ID, i.StartDate, i.EndDate, i.Title); 
 
                    appList.Add(ap); 
                } 
 
                return appList; 
            } 
        } 

But when I launch my site I get error: Message from webpage: "The server method 'GetAppointments' failed. When I set breakpoint on my method then I see that method isn't even called by Scheduler. I post scheduler and script manager code here:

<telerik:RadScheduler ID="RadScheduler1" runat="server" EnableAdvancedForm="false"
            <WebServiceSettings Path="../../Models/SchedulerWebService.asmx" /> 
            <AdvancedForm Modal="false" /> 
        </telerik:RadScheduler> 

and

<telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 

0
Atanas Korchev
Telerik team
answered on 11 Sep 2009, 02:13 PM
Hello gordon gordon,

This is very strange. The web service should be called correctly provided the XML population worked as expected.

Unfortunately we cannot tell what the problem is without reproducing it first. Please open a support ticket and attach your project so we can test it.

Regards,
Albert,
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
Tee Bee
Top achievements
Rank 1
answered on 04 Dec 2009, 03:38 PM
Thanks for this test project.  I'm trying this as is, before I use it in my actual project.  I'm using Firefox 3.x on Win2003.
I can get the list of appointments, insert  but, when I double click to edit the existing appointment, it gives me a blank screen.
Could you tell me, if I'm missing something.

thanks,

0
T. Tsonev
Telerik team
answered on 10 Dec 2009, 08:03 AM
Hello Tee Bee,

Thank you for reporting this issue.

The problem is caused by the fact that the advanced edit/insert form is disabled in my original example and the scheduler tries to display it when editing an appointment. This is a bug in itself and we'll look into it.

As for the example, I've enabled the advanced form and everything seems to be working fine. I'm uploading the updated project here.

As a token of our gratitude for your involvement, your Telerik points have been updated.

All the best,
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
Andrew
Top achievements
Rank 1
answered on 13 Apr 2010, 12:30 PM
I also need the RadScheduler in MVC. I have created my own SQL data provider (using LINQ) and I assume I need to hook it up to a web service as you have done in your example above. I took a look at your examples, but have a couple of further questions:
1) I need to filter out the appointments that I query based on a couple of rules:
        a) whether the user has access to these appointments (no access, read only or read/write)
        b) filtered by the "siteId" which the user has requested (which is a field in the Appointments table of my SQL database)
Normally, I got these variables from either the "Session" or the "ViewData". Will that still be available to me in the RadSchedule Control Data Source? if not, how do I pass these parameters in when I call the View that displays the schedule?
Can I extend my RadScheduler control from System.Web.Mvc.ViewUserControl? and will this solve my issues of passing around data in the Session variables?
2) Periodically, I will have an "Execution Server" which needs to read through the appointments and see which ones need attention (this server will send e-mail as well as invoke other actions). I will have to add custom fields to the Appointment to facilitate this. Although I have not tried adding custom fields, I think you have a section on doing just that in the docs. There will be 1000's of sites each with perhaps a maximum of 30 appointments most of which will be recurring. How do I parse through the Appointments table in a very timely/efficient fasion to see if any of my appointments require action (based on date/time)? It seems as though currently it is a question of somehow Pattern Matching (using Recurrence Rule????).

Any help would be greatly appreciated.
0
T. Tsonev
Telerik team
answered on 16 Apr 2010, 09:03 AM
Hi Roman,

Please, accept my apologies for the late reply.

The session is available when using web service data binding and is suitable for passing values such as userId or siteId. Take a look at the example web service (Live Demos\App_Code\SchedulerWebService.cs) on how to enable the session:

[WebService]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class SchedulerWebService : WebService, IRequiresSessionState
{
 
    [WebMethod(EnableSession = true)]
    public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)
    {
        return Controller.GetAppointments(schedulerInfo);
    }
 
// ...
}

You can send additional extra data from the client to the web service by handling appointmentsPopulating event. An example can be found here:

http://www.telerik.com/community/forums/aspnet-ajax/scheduler/sending-extra-info-to-the-web-service.aspx#789023

I'm not sure if ViewUserControl will help here as most of the logic will be in the service and provider.

The recommended approach for evaluation recurrences is via the RecurrenceRule class. Please, look at these examples:

http://www.telerik.com/help/aspnet-ajax/schedule_serversideworkingwithrecurringappointments.html
http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.recurrencerule-seteffectiverange.html

We also have an example on how to evaluate recurrence rules in SQL Server managed UDF:

http://blogs.telerik.com/tsvetomirtsonev/posts/08-08-04/working_with_radscheduler_recurring_appointments_on_sql_server.aspx

I hope this helps.

Best wishes,
Tsvetomir Tsonev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Varun
Top achievements
Rank 1
answered on 02 Sep 2011, 03:09 AM
avatar

Posted 0 minutes ago (permalink)

I have problem using RadScheduler on an MVC Project. It works well over http but when we use https, it gives getappointments failed error.

Reason i have checked using Firebug is that it is not able to find the Service used.

Please check. Gives  a 404 error.

http://mytimescore.com/Models/SchedulerWebService.asmx/GetAppointments

Please help!

Varun
0
Benoit Drapeau
Top achievements
Rank 1
answered on 19 Sep 2011, 10:57 PM
Hi,

In my situation, I had to put the following code  to make it work with https. Hope it will help you!

Benoit

protected override void OnInit(EventArgs e)
{
	base.OnInit(e);
 
        RadScheduler1.ResourcesPopulating += new Telerik.Web.UI.ResourcesPopulatingEventHandler(RadScheduler1_ResourcesPopulating);
}
 
protected void RadScheduler1_ResourcesPopulating(object sender, Telerik.Web.UI.ResourcesPopulatingEventArgs e)
{
	HttpCookie cookie = FormsAuthentication.GetAuthCookie(User.Identity.Name, false);
        string cookieHeader = string.Format("{0}={1}", cookie.Name, cookie.Value);
        e.Headers.Add(HttpRequestHeader.Cookie, cookieHeader);
}

0
Ramakrishna
Top achievements
Rank 1
answered on 19 Jun 2012, 05:11 PM
Hi
me also implemented scheduler in MVC, my requirement is i want to export scheduler to PDF is it possible? if so can any one give guidance to me to achieve this
last but not least is it possible to export scheduler as image if so how can we, one of my client need this
0
Peter
Telerik team
answered on 20 Jun 2012, 02:46 PM
Hi Ramakrishna,

MVC does not allow server-side event handling, so it is not possible to use the server ExpoertToPdf method of RadScheduler.

All the best,
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.
Tags
Scheduler
Asked by
Carlos Souto
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Carlos Souto
Top achievements
Rank 1
gordon gordon
Top achievements
Rank 1
Atanas Korchev
Telerik team
gordon gordon
Top achievements
Rank 1
Tee Bee
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Varun
Top achievements
Rank 1
Benoit Drapeau
Top achievements
Rank 1
Ramakrishna
Top achievements
Rank 1
Peter
Telerik team
Share this question
or