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

$find failing to find Ajax control in master page

4 Answers 216 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
PaulMrozowski
Top achievements
Rank 1
PaulMrozowski asked on 25 Nov 2008, 07:55 PM
 I have a master page which has an instance of the RadAjaxManager on it (Named RadAjax). I have a content page which has options to open a window (RadWindow). When you click on a button on this open window it injects some JavaScript that is supposed to force a refresh of the calling page, then close itself. I'm in the process of trying to update to the AJAX version of the controls and things aren't quite working.

In my first content page, I have this JavaScript function:

var ajaxManager = $find("<%= Telerik.Web.UI.RadAjaxManager.GetCurrent(Page).ClientID %>"); 
ajaxManager.ajaxRequest("Rebind"); 

I know this function is getting called correctly from my "pop in" form. However, ajaxManager is null so the rebind never occurs. I looked at the generated JS in the page and the markup is getting translated to this, which looks correct. What am I missing?

var ajaxManager = $find("ctl00_RadAjax"); 
 




4 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 26 Nov 2008, 12:14 PM
Hi Paul,

Please try to use the code below instead the one you provided and let me know if this helps:

$find("<%= RadAjax.GetCurrent(Page).ClientID %>").ajaxRequest("Rebind");


Kind regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
PaulMrozowski
Top achievements
Rank 1
answered on 26 Nov 2008, 01:22 PM
Unfortunately, it doesn't. Now the page fails with a compilation error - "The name 'RadAjax' does not exist in the current context" (which it doesn't - RadAjax is on the master page).
0
PaulMrozowski
Top achievements
Rank 1
answered on 26 Nov 2008, 01:39 PM
 I just added a property to my content page that looks at the master page, does a FindControl to get the reference to my RadAjaxManager and returns it directly. Then I modifed my JS code to use this new property to reference the ClientID. That seems to work.
0
Maria Ilieva
Telerik team
answered on 26 Nov 2008, 02:50 PM
Hi Paul,

I'm glad that you have managed to fix the issue and find appropriate approach for your scenario.

Do let us know if further assistance is needed.

Kind regards,
Maria Ilieva
the Telerik team

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