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

AjaxManager response scripts

3 Answers 194 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ivaylo
Top achievements
Rank 1
Ivaylo asked on 21 Feb 2011, 11:29 AM
Hi,

I am using Rad Ajax Manager and I have added some response scripts in my serverside code. In the response scripts I use $find('...'); to access some telerik controls on the page in the client-side. Each time i try to do this, the $find method returns null. I suppose this is because the corresponding controls are not updated by the ajax manager via the ajax settings. Here is the issue - I do not want them to be updated, there will be no state change to these controls, but I still want to access them after the response (to retrieve or update the selected value of a combobox for instance). Is there a way I can achieve this without adding ajax settings for the controls I want to $find(). The reason for this is to reduce the amount of the response's markup and server-side roundtrips (this also comes as a requirement from our clients). Also, since there has not been any server-side modification on these controls, I consider it unnecessary to update them every time.

Another question - at which state of the client-side lifecycle the response script is called - before or after the load (Sys.Application.add_load) function?. Can I use the response script to hook my logic in the load stage instead of directly calling it?

Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Ivaylo
Top achievements
Rank 1
answered on 22 Feb 2011, 11:49 AM
I sent a ticket #396673 regarding the same issue.
0
Maria Ilieva
Telerik team
answered on 24 Feb 2011, 01:45 PM
Hello Ivaylo,

The presented behavior is actually not expected in such scenarios. Calling some function in the RadAjax ResponseScripts method is the same as executing this code in the PageLoad client event handler. So it is not necessary to have the used in this function controls added to the RadAjax setting in order to have this works properly. Could you please try setting SetTimeout(0) in the mentioned function and verify if this makes any difference.

Also please avoid opening support and forum tickets for the same issue so the case could be better tracked by some of our support person.

Greetings,
Maria Ilieva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Ivaylo
Top achievements
Rank 1
answered on 24 Feb 2011, 01:48 PM
It seems that the execution order of loading the controls and the response scripts is non-deterministic in its nature. I actually used setTimeout(arguments.callee, 10)  in my function until the desired controls became loaded and available. It was useful to know that the response script executes in the load phase of the clien-side lifecycle.
Tags
Ajax
Asked by
Ivaylo
Top achievements
Rank 1
Answers by
Ivaylo
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or