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

Losing the AjaxManager in client script

1 Answer 33 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
SultanOfSuede
Top achievements
Rank 1
SultanOfSuede asked on 30 Oct 2008, 07:05 PM
I have this JavaScript code:

        function recipient_click(ajaxMgrId, checkBoxId, contactId) {
            var chk = $get(checkBoxId);
            var mgr = $find(ajaxMgrId);
            var args = '';
            
            if (chk.checked) {
                args += 'Add:' + contactId;
            }
            else {
                args += 'Remove:' + contactId;
            }

            mgr.ajaxRequest(args);
        }

On the first click of a checkbox, the code works.  On the second click, the last line (mgr.ajaxRequest...) fails because mgr is null.  The ids of the manager have not changed between calls, but $find() does not work.  No exceptions are occurring in the server side code. 

Any thoughts on why the Ajax Manager is null on subsequent calls?

Thanks in advance...


1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 31 Oct 2008, 01:33 PM
Hi,

A possible cause for such behavior will be if AjaxManager client object is not yet loaded or created after the ajax request. However it is hard to tell what may cause this from the given details. Therefore it will be appreciated if you can give us little more details about your scenario, implementation and some code snippets.

Greetings,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
SultanOfSuede
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or