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

using $find method in DNN module

2 Answers 69 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
JC Wu
Top achievements
Rank 1
JC Wu asked on 29 Dec 2009, 01:15 AM

I have a program that needs to call ajaxRequest from client side.
When I use this code in any aspx page, it works fine.
But when I put it into a DNN module,the $find method always return null.
Is there any difference in DNN module?

var ajaxManager = null;  
 
        function pageLoad() {  
            if (ajaxManager == null) {  
                ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");  
            }  
        }  
        function SuccessHandler(privateToken, alias, message) {  
            var datetime = new Date();  
            ajaxManager.ajaxRequest("(" + datetime.toLocaleTimeString() + ")");  
        } 

2 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 29 Dec 2009, 12:58 PM
Hi JC Wu,

Have you tried with:

ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");

In a DNN module, you may not (and should not) have RadAjaxManager placed in the module. It needs to go in a master page or an ASPX page if no master. Therefore, we use the static RadAjaxManager.GetCurrent() method to get a reference to the current instance of the manager.

Greetings,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
JC Wu
Top achievements
Rank 1
answered on 30 Dec 2009, 03:09 AM
Thanks for reply.
I have tried
ajaxManager = $find("<%=(this.Page.FindControl("RadAjaxManager1") as RadAjaxManager).ClientID%>"); 
and
ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>"); 

In first case, it gets null value when first time open the page.
In second case,it works fine.
Tags
Ajax
Asked by
JC Wu
Top achievements
Rank 1
Answers by
Veli
Telerik team
JC Wu
Top achievements
Rank 1
Share this question
or