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

How to check if RadAjaxManager exists on the page?

1 Answer 155 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Simone
Top achievements
Rank 1
Simone asked on 10 Feb 2012, 10:17 PM
I get this error because I am using a user control that is inside a page that doesn't have RadAjaxManager.
How do I check if RadAjaxManager exists on the parent page before getting the error? Some parent pages do have
RadAjaxManager, some others don't.

And if it doesn't exist,  I do not want to make a request.

Thanks in advance.


Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 69:         function refreshScreen(action) {
Line 70: 
Line 71:             $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest(action);
Line 72: 
Line 73:         }   

1 Answer, 1 is accepted

Sort by
0
Simone
Top achievements
Rank 1
answered on 10 Feb 2012, 10:41 PM
I think I figured it out:


        function refreshScreen(action) {
            
            <%= RadAjaxManager.GetCurrent(Page) == null? "" : "$find('" + RadAjaxManager.GetCurrent(Page).ClientID  + "').ajaxRequest(action);"  %>
                
        }  
Tags
Ajax
Asked by
Simone
Top achievements
Rank 1
Answers by
Simone
Top achievements
Rank 1
Share this question
or