AjaxManager response scripts

4 posts, 0 answers
  1. Ivaylo
    Ivaylo avatar
    6 posts
    Member since:
    Feb 2011

    Posted 21 Feb 2011 Link to this post

    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
  2. Ivaylo
    Ivaylo avatar
    6 posts
    Member since:
    Feb 2011

    Posted 22 Feb 2011 Link to this post

    I sent a ticket #396673 regarding the same issue.
  3. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 24 Feb 2011 Link to this post

    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!
  4. Ivaylo
    Ivaylo avatar
    6 posts
    Member since:
    Feb 2011

    Posted 24 Feb 2011 Link to this post

    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.
Back to Top