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

How to set TimelineView-StartTime property in JavaScript/MVC

6 Answers 137 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kushil
Top achievements
Rank 1
Kushil asked on 10 May 2011, 02:32 PM
Hi all
I am developing an ASP.NET MVC application. I have radScheduler in one page connected to a web service which pulls appoinments from the database. There are different appoinment types and there is one appoinment which can be moved across time slots. I need to show that appoinment in the scheduler when the page is loaded(initially and dynamically with other client side events). In order to do that I need to set "TimelineView-StartTime" property. It is a serverside property and I cannot find the corresponding JavaScript property. Since this is an MVC application I cannot set the property within server side tags. Could you please tell me how to set this "TimelineView-StartTime" property in ASP.NET MVC application dynamically? I cannot find the corresponding JavaScript property.
Thanks in advance
Kushil

6 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 10 May 2011, 03:19 PM
Hi Kushil,

You can access the TimelineView settings of the RadScheduler via the get_timelineViewSettings() client-side method of the scheduler object. Also you can use the set_timelineViewSettings() method to set the StartTime of the TimelineView.

Best wishes,
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
Kushil
Top achievements
Rank 1
answered on 10 May 2011, 11:20 PM
Hi Veronica
Thanks very much for your response. I am so glad to know that it is possible.
Could you please give me a sample code to use  set_timelineViewSettings() method to set the StartTime of TimelineView?
I know that I can get the JavaScript object of the scheduler like this.
var scheduler = $find('<%= RadScheduler1.ClientID %>');

After that I am not sure how I should use set_timelineViewSettings() method to set the StartTime.

I would really appreciate if you could respond to this.
Thanks again
Kushil
0
Kushil
Top achievements
Rank 1
answered on 11 May 2011, 02:22 AM
Ok, Veronica. I found a way. It is

var scheduler = $find('<%= RadScheduler1.ClientID %>');
scheduler.get_timelineViewSettings().startTime = 3600000;

But I still do not know how to use set_timelineViewSettings() method.
Thanks very much for your help.


0
Veronica
Telerik team
answered on 17 May 2011, 07:41 AM
Hi Kushil,

Please accept my apologies for misleading you.

Actually you can not set the StartTime property of the TimelineView client-side. The reason is that the RadScheduler is already rendered and any settings that cause change of the rendering would not take effect on the client. As a workaround I'll offer you to use the OnAjaxRequest method of the AjaxManager.

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
Kushil
Top achievements
Rank 1
answered on 21 Jun 2011, 03:15 AM
Thanks Veronica.
I tried this. But I am getting the following error when I call "ajaxRequest()" method.
"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled"
Is it because ASP.NET MVC does not support postbacks (even async) as mentioned in here?
http://forums.asp.net/t/1258905.aspx/1?Sys+WebForms+PageRequestManagerParserErrorException

It seems like we cannot hook anything up to a server side event in MVC.

And in a seperate note I would like to say that the following works in the client side.
var scheduler = $find('<%= RadScheduler1.ClientID %>'); 
scheduler.get_timelineViewSettings().startTime = 3600000;

I can set startTime in clientside and the scheduler renders again when I call the following from clientside.
scheduler.set_selectedDate(date);   //date is a valid date from seperate a datePicker
But I also need to set the "numberOfSlots" property in radScheduler which Telerik client side api does not allow me to do. The following is the way I tried.
var sch = $find('<%= RadScheduler1.ClientID %>'); 
sch.get_timelineViewSettings().startTime = data.operatingHoursStart; //data is JSON return object
sch.get_timelineViewSettings().slotDuration = data.BlockDuration; //data is JSON return object
sch.get_timelineViewSettings().numberOfSlots = data.NoOfSlotsPerDay;      // data is JSON return object.
                                                                          // NoOfSlotsPerDay property has got a value like 8 (abosolute even number) 
sch.set_selectedDate(date);     //Render Scheduler again. 
                                //date is a valid date from a seperate datePicker 

The above changes start time and slot duration. But it does not change the number of slots  in scheduler when it is re-rendered. The scheduler shows only three slots(two time heading boxes where firest one got two slots) which is the default. But when I inspect the numberOfSlots property in scheduler JavaScript object I can see that it has correctly been set to a different value. Is this a bug in scheduler?
As an alternative when I set endTime (in miliseconds) instead of numberOfSlots and call set_showFullTime(true) I get the following error in Telerik's dynamically generated javascript.

Microsoft JScript runtime error: '0.rows' is null or not an object

Then I set ShowFullTime=True in design time (server property). It still shows only 3 slots (two time heading boxes) which is the default in radScheduler.

Please help me.

Thanks in advance
Kushil
0
Veronica
Telerik team
answered on 24 Jun 2011, 12:09 PM
Hello Kushil,

Please accept my apologies for misleading you.

After further consulting with the Ajax Team - the result is that you can not use AJAX Request in the MVC application as you found on your own. Unfortunately as I answered in my previous post - change of the NumberOfSlots requires re-rendering of the RadScheduler which can not be done client-side as the control is already rendered then.

Please accept my apologies for the caused inconvenience and let me know if I can help you with anything else.

All the best,
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.

Tags
Scheduler
Asked by
Kushil
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Kushil
Top achievements
Rank 1
Share this question
or