Although there is really very good client-side support in Telerik controls, I can't find the way to subscribe AjaxManager OnResponseEnd/OnRequestStart events on client-side. The only way that I see is to do this on server-side (via codebehind or via declaration).
Could you please clarify if there is any way to subscribe to these events on client-side?
Could you please clarify if there is any way to subscribe to these events on client-side?
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 22 Dec 2011, 01:11 PM
Hello Andrey,
You can attach client events as explained in this documentation. Also check the online demo which implements the same.
-Shinu.
You can attach client events as explained in this documentation. Also check the online demo which implements the same.
-Shinu.
0
Andrey
Top achievements
Rank 1
answered on 22 Dec 2011, 08:47 PM
Thank you for links, Shinu, but I have read these articles. They explain that you can attach client-side events to ResponseEnd/RequestStart via assigning property on server-side, but I need to do this completely in javascript. Like:
$find(ajaxManagerId).add_onResponseEnd(func)
Is there any way to do this?
$find(ajaxManagerId).add_onResponseEnd(func)
Is there any way to do this?
0
Kevin
Top achievements
Rank 2
answered on 23 Dec 2011, 03:04 PM
Hello Andrey,
You can attach the events using js like so:
You'll just need to register it every time an ajax request is performed, as it gets removed.
I hope that helps.
You can attach the events using js like so:
$find(ajaxManagerId).OnResponseEnd = func;
You'll just need to register it every time an ajax request is performed, as it gets removed.
I hope that helps.
0
Hello Andrey,
You could hook the OnAjaxRequest and OnResponceEnd events of RadAjaxManager just like you will do it with any JavaScript event. Namely:
However, with this approach you are loosing the specific information from the OnRequestStart event argument and you are receiving the DOM event argument.
Another approach is to hook the OnRequestStart event from the server and in its body to check if some condition is met and then to cancel the event. Like this:
Greetings,
Andrey
the Telerik team
You could hook the OnAjaxRequest and OnResponceEnd events of RadAjaxManager just like you will do it with any JavaScript event. Namely:
function
pageLoad(sender, args) {
var
ajaxManager = $find(
"<%=RadAjaxManager1.ClientID %>"
);
ajaxManager.OnRequestStart =
"requestStart(this, event)"
;
}
function
requestStart(sender, args) {
alert(
"Request had started"
);
}
However, with this approach you are loosing the specific information from the OnRequestStart event argument and you are receiving the DOM event argument.
Another approach is to hook the OnRequestStart event from the server and in its body to check if some condition is met and then to cancel the event. Like this:
function
requestStart(sender, args) {
if
(some condition is met){
args.set_cancel(
true
);
}
}
Greetings,
Andrey
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