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

Control gets ajaxified without intent

4 Answers 69 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 18 Aug 2008, 11:34 AM
Hello!

I have a user control that searches recursively for an radajaxmanger in its page hierarchy. Then the control adds its components that should be ajaxified like that:

ajaxManager.AjaxSettings.AddAjaxSetting(btnEditValues, gridPanel, radLoadingPanel);

the page hierarchy looks like that

Page (with the Ajax Manager)
-Control
--gridPanel
---btnEditValues

Now every control in the gridPanel makes an ajaxpostback as well.
When I try to exclude the control from the AjaxRequest with a javascript (OnRequestStart for example) the Clientside event "OnRequestStart" is not even called. But still an ajax postback is made.

I successfully excluded other controls from the postback, like "btnEditValues".

Is it possible that control that are the updated ones a somehow implicitly the updating ones as well ??

I'm really stuck here...

thx in advance for your help,

kind regards,
 M

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 18 Aug 2008, 02:41 PM
Hi Markus,

Indeed, this is the default behavior of RadAjaxManager. Here is how to disable AJAX requests from child controls:

http://www.telerik.com/help/aspnet-ajax/ajxexclude.html


Sincerely yours,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Markus
Top achievements
Rank 2
answered on 18 Aug 2008, 02:47 PM
Hi Dimo,

It's the default behaviour that a control that becomes the updated control becomes the updating control as well??

anyway, if this behaviour is expected, I wonder why I don't reacht the OnRequestStart event of the RadAjaxManager if one of the originally updated controls initializes an ajax postback.

I had to had the gridPanel as updating control and then I get into the OnRequestStart eventhandler. This is one more workaround I don't like...
Is it expected?

kind regards
0
Dimo
Telerik team
answered on 18 Aug 2008, 03:34 PM
Hi Markus,

I misunderstood your question, sorry about that.

Anyway, the observed behavior is caused by the MS AJAX framework. Here is the workaround:


1) First, you need to ajaxify the gridPanel like this:

ajaxManager.AjaxSettings.AddAjaxSetting(gridPanel, gridPanel, radLoadingPanel);


Now the OnRequestStart event will be fired for all AJAX request. From this point:


2) Check the event target in the OnRequestStart event handler and cancel the AJAX request if the event target is not
btnEditValues:


    function RequestStart(sender, args)
    {
        if (args.get_eventTarget().indexOf("
btnEditValues") == -1)
        {
            args.set_enableAjax(false);
        }
    }



Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Steven
Top achievements
Rank 1
answered on 23 Sep 2014, 01:04 AM
This line:

ajaxManager.AjaxSettings.AddAjaxSetting(gridPanel, gridPanel, radLoadingPanel);

Resolved an issue for me where the ajaxRequestStart and ajaxRequestEnd client side events of RadAjaxManager were not being fired for a RadListView control within a user control where a panel on the parent page was ajaxified.

Masterpage
> Page
>> Panel (Ajax Updated Control)
>>> UserControl
>>>> RadListView (Ajax initiator/updated control)

The trick was to make the Panel an Ajax Initiator also. Then the client events began to fire.





Tags
Ajax
Asked by
Markus
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Markus
Top achievements
Rank 2
Steven
Top achievements
Rank 1
Share this question
or