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

[Solved] Dropping an item on Calendar

1 Answer 111 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Hrushikesh Mokashi
Top achievements
Rank 1
Hrushikesh Mokashi asked on 07 Apr 2009, 01:00 PM
Hi All,
I want to drop an item on RadCaneldar and highlight the date/dates on which items are dropped.

On Server side Dayrender event I have writted the code like below where I am attaching 'OnDrop' event to the each cell.

 

Dim sDate As String = Convert.ToString(e.Day.Date)

 

e.Cell.Attributes.Add(

"ondragenter", "return fnCancelDefault();")

 

e.Cell.Attributes.Add(

"ondragover", "return fnCancelDefault();")

 

e.Cell.Attributes.Add(

"ondrop", "return GetSchedulerDroppedItem('RadCalMonth1','" & sDate & "');")

My client side function is,

 

 

function GetSchedulerDroppedItem(SchedulerName,droppeddate) {

 

 

var htmlElement = event.srcElement; //eventArgs.get_destinationHtmlElement

 

 

 

 

var SchedulerControl;

 

 

 

var hiddenDroppedSchedulerID = document.getElementById("ctl00_Content_hFieldDroppedSchedulerID");

 

 

else if (SchedulerName == "RadCalMonth1") {

 

SchedulerControl = document.

get('ctl00_Content_RadCalMonth1');

 

hiddenDroppedSchedulerID.value =

"RadCalMonth1";

 

}

 

var droppeddatetimecontrol = document.getElementById('ctl00_Content_hFieldDroppedDateTime');

 

droppeddatetimecontrol.value = droppeddate;

 

 

//// var ajaxmanager = $find("ctl00_RadAjaxManager1");

//// ajaxmanager.Request();

 

 

//__doPostBack('TestCntrl','');

 

 

 

PageMethods.UpdateJob_OnDrop(SchedulerControl);

 

 

}

In the above function I want to use postback function that will not cause full page to refresh.
In RadScheduler there is one event "InsertAppointment"

 

var

newAppointment = new Telerik.Web.UI.SchedulerAppointment();

 

var dt = new Date(timeSlot._startTime);

 

newAppointment.set_start(dt);

newAppointment.set_end(dt);

newAppointment.set_subject(

"");

 

SchedulerControl.insertAppointment(newAppointment);

 

This calls server side AppointmentInsert event of Scheduler and does not refreshes the page.

How can I achieve such thing for RadCalender?
Also, after post back I want to show the dropped date highlighted.

Can anyone help me in this?

Best Regards,
Hrushikesh

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 10 Apr 2009, 09:20 AM
Hi Hrushikesh Mokashi,

Are you using a RadGrid to drag the items from? In this case, you need to attach an event handler to the grid's OnRowDropped client event and go from there.

You can get the date on which an item has been dropped by obtaining the destinationHtmlElement, after that its parentNode and in the title the date is contained, you just need to parse it.

As for highlighting the corresponding date, you can do this in the DayRender event by changing the date's css style. Fore example:

e.Cell.Style.Add("background""yellow"); 

I hope this information will be helpful to you.

Best Regards,
Tsvetoslav
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Calendar
Asked by
Hrushikesh Mokashi
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or