Another thing, the tooltip never fires the OnRequestStart or OnResponseEnd AjaxManager events. It is only after an ajax request is cancelled will this happen.
10 Answers, 1 is accepted
var tooltipShowing = false;
function ToolTipOnClientBeforeShow() { tooltipShowing = true; }
function ToolTipOnClientHide() { tooltipShowing = false; }
function AjaxRequestEnd(sender, eventArgs) {
if (tooltipShowing) { eventArgs.set_cancel(true);return false; }
...
}
It seems there should be some way of preventing this action. Maybe the order in which I'm doing something is causing this weird behavior. The problem I've experienced with workarounds like this is that perhaps this will trip some other issue later on or maybe I'm covering up a previous error that I've overlooked.
The provided information is not enough for us to fully understand your scenario. Could you please provide a little bit more details?
How do you show the tooltip, what are the AJAX settings and why do you disable the AJAX when the tooltip is showing?
I am looking forward to your reply.
Regards,
Mira
the Telerik team
You can access the UniqueID of the AJAX initiator on RequestStart using the get_eventTarget() method.
The sender of the event is always the corresponding RadAjaxManager.
Please use this approach and let me know whether it helps.
If the issue persists, please send sample code demonstrating the problem.
Kind regards,
Mira
the Telerik team
Mira, see attached sample and do the following steps:
1. hover over tooltip. Tooltip is shown fine (no ajax client events are fired)
2. click the save link. both ajax client events are fired.
3. hover over tooltip. (same as step 1)
4. click the delete link. ajaxrequeststart is fired and the event is cancelled.
5. hover over tooltip. notice how ajaxrequestend event is fired with same arguments as previously cancelled delete link.
Question is why is this? My workaround was to try and trap when this is the case since there is no way of knowing the ajaxendevent is being fired now because of the previously cancelled event. Also, if you click back on the save link, both ajax events are fired and the tooltip works fine. The ajaxmanager seems to be getting crossed up in there somehow.
.ASPX
<form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <script type="text/javascript"> //Put your JavaScript code here. </script> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script language="javascript" type="text/javascript"> function AjaxRequestStart(send, eventArgs) { alert("AjaxRequestStart " + eventArgs.get_eventTarget() + " " + eventArgs.get_eventArgument()); if (eventArgs.get_eventArgument() == 0) { eventArgs.set_cancel(true); return false; } } function AjaxRequestEnd(sender, eventArgs) { alert("AjaxRequestEnd " + eventArgs.get_eventTarget() + " " + eventArgs.get_eventArgument()); $find("<%=rnEventNotification.ClientID %>").show(); } </script> </telerik:RadCodeBlock> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="AjaxRequestStart" ClientEvents-OnResponseEnd="AjaxRequestEnd"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="rtbEvent"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="rtbEvent" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="rnEventNotification" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default" /> <telerik:RadNotification ID="rnEventNotification" runat="server" EnableShadow="true" Text="" Title="" /> <telerik:RadToolBar ID="rtbEvent" runat="server" Width="100%" Height="30" EnableEmbeddedSkins="false" Skin="Category"> <Items> <telerik:RadToolBarButton Value="Delete" CommandName="Delete" Text="Delete"></telerik:RadToolBarButton> <telerik:RadToolBarButton Value="Save" CommandName="Save" Text="Save"></telerik:RadToolBarButton> </Items> </telerik:RadToolBar> <telerik:RadToolTipManager ID="rttmEventPreview" OffsetY="-1" Width="350" Height="350" runat="server" EnableShadow="true" OnAjaxUpdate="OnAjaxUpdateToolTip" HideEvent="LeaveTargetAndToolTip" RelativeTo="Element" Position="MiddleRight"> </telerik:RadToolTipManager> </form> .ASPX.VB
Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack And Not RadAjaxManager1.IsAjaxRequest Then Dim hyp As New HyperLink hyp.NavigateUrl = "# hyp.Text = "link1" form1.Controls.Add(hyp) rttmEventPreview.TargetControls.Add(hyp.ClientID, "1", True) RadAjaxManager1.AjaxSettings.AddAjaxSetting(hyp, rttmEventPreview) Dim lit As New Literal lit.Text = "<br/>" form1.Controls.Add(lit) hyp = New HyperLink hyp.NavigateUrl = "# hyp.Text = "link2" form1.Controls.Add(hyp) rttmEventPreview.TargetControls.Add(hyp.ClientID, "2", True) RadAjaxManager1.AjaxSettings.AddAjaxSetting(hyp, rttmEventPreview) lit = New Literal lit.Text = "<br/>" form1.Controls.Add(lit) End IfEnd SubProtected Sub OnAjaxUpdateToolTip(sender As Object, args As ToolTipUpdateEventArgs) Me.UpdateToolTip(args.Value, args.UpdatePanel) End SubPrivate Sub UpdateToolTip(elementID As String, panel As UpdatePanel) Dim lbl As New Label lbl.Text = "the time is " & Date.Now panel.ContentTemplateContainer.Controls.Add(lbl) End SubPrivate Sub rtbEvent_ButtonClick(sender As Object, e As Telerik.Web.UI.RadToolBarEventArgs) Handles rtbEvent.ButtonClick Dim btn As RadToolBarButton = TryCast(e.Item, RadToolBarButton) If Not btn Is Nothing Then If btn.CommandName = "Delete" Then rnEventNotification.Title = "Activity Deleted" rnEventNotification.Text = "Activity deleted successfully" ElseIf btn.CommandName = "Save" Then rnEventNotification.Title = "Activity Saved" rnEventNotification.Text = "Activity saved successfully" Else rnEventNotification.Title = "" rnEventNotification.Text = "" End If End IfEnd SubThe described issue is expected due to the behavior of the PageRequestManager.
You can examine the attached project for additional information.
I hope this helps.
All the best,
Mira
the Telerik team
Also, what is the prm.abortPostBack() actually doing? It appears that it is not doing anything.
The behavior demonstrated in my project is the expected one due to the way the PageRequestManager, on which the RadAjaxManager depends, works.
You can see that the EndRequest event is fired by the manager, even though the postback is canceled with the abortPostBack method.
Please let me know if any further questions arise.
Kind regards,
Mira
the Telerik team
After further research on the problem and deeper investigation by our developers we conclude that the presented behaviour is a bug in the RadAjax. We already logged this bug in out tracking system and a fix will be available in the upcoming beta release.
For now you could avoid this behaviour by terminating the request in the PageRequestManager InitializeRequest event, like this:
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(Initialize); function Initialize(sender, args) { var prm = Sys.WebForms.PageRequestManager.getInstance(); alert("PRM_request_start"); if (prm.get_isInAsyncPostBack() & args.get_postBackElement().id == 'rtbEvent') { args.set_cancel(true); prm.abortPostBack(); } }Thank you for reporting this to us and for your cooperation.
All the best,
Maria Ilieva
the Telerik team