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

Radtooltip for Scheduler Appointment generated from code behind

1 Answer 91 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
MarkSci
Top achievements
Rank 1
MarkSci asked on 25 Jan 2012, 03:32 PM
Hi,

I've been looking at http://demos.telerik.com/aspnet-ajax/scheduler/examples/radtooltip/defaultcs.aspx but I can't get it to work for my scenario. Is there an example of how to implement a radtooltip from a scheduler appointment item where:

- The Scheduler is generated entirely from the codebehind and implements a custom Appointment template
- The markup uses an AjaxManager and not UpdatePanels

Also, why do the examples not separate Client Side and Server side creation? I eventually found a good client side example (http://www.telerik.com/community/code-library/aspnet-ajax/scheduler/show-radtooltip-on-appointment-click-entirely-client-side-implementation.aspx) but it uses UpdatePanels and I couldn't get it to work because the javascript

var apt = $find("<%=RadScheduler.ClientID %>").getAppointmentFromDomElement(element);

causes an error.

I'm happy to use Client side or Server Side - but I don't want code for both in my project.

Thanks

Mark

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 27 Jan 2012, 03:09 PM
Hello Mark,

I am sorry to say that there isn't such an example. You can see how to use the Scheduler's templates in this online demo: http://demos.telerik.com/aspnet-ajax/scheduler/examples/templates/defaultcs.aspx. There shouldn't be a difference whether you create it in the markup or in the code-behind. What is important is that the same event handlers are attahed - both client-side and server side.

This is a really complex scenario, as both controls can use AJAX (and especially the RadToolTipManager must) and two subsequent AJAX requests cancel each other and this produces issues. This is the reason why in the demo we handle the beginRequest event of the PageRequestManager - to make sure that two requests are not performed at the same time, for example when dragging appointments. Such scenarios would otherwise seem to show an incorrect tooltip otherwise as well.  The RadAjaxManager, while very comfortable and easy to configure (especially when many settings are needed), encapsulates a lot of the AJAX functionality while we need to be able to fine-tune things in this case.

All the above means that client-side and server-side functionality cannot be separated entirely. Note, however, the ModeSelector_SelectedIndexChanged method in the code-behind. This is the one that attaches or detaches the client-side OnClientRequestStart event handler of the RadToolTipManager. This is the only difference between a client-side and server-side functionality for the tooltips  in the demo - this client-side handler cancels the AJAX request from the ToolTipManager and uses JavaScript to produce the needed content. You need to have code-behind, however, to fill the TargetControls collection of the RadToolTipManager in any case.

When going client-side you can use the regular RadToolTip as shown in the CL article you linked. Please copy the code from the markup and see if it fits your needs. It uses the same JavaScript approach to get the data for the tooltip, yet the RadToolTip does not perform any AJAX requests and can be attached to one target, so you need to handle the client events of the RadScheduler to show or hide it via JavaScript again. There is currently a technical issue with the attached file, it will be corrected with the right code after the weekend, so please stay tuned (although the most significant code can be copied from the post). The specific line you point out looks like has a wrong ID set, please try changing it to RadScheduler1.ClientID (or rather to the exact ID of the scheduler in your page).


All the best,
Marin
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
ToolTip
Asked by
MarkSci
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or