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

[Solved] Very simple, what am I doing wrong?

2 Answers 71 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Michael Dunbar
Top achievements
Rank 2
Michael Dunbar asked on 20 May 2009, 07:56 AM
Hi,

Just trying to use the Ajax manager to call a server side function from JavaScript in a user control. I followed the getting started documentation and set up the following:

JavaScript
// Gets the ASP.NET generated control ID 
function GetClientId(controlId) { 
    var count = document.forms[0].length; 
    var i = 0
    var aspControlId; 
    for (i = 0; i < count; i++) { 
        aspControlId = document.forms[0].elements[i].id; 
        pos = aspControlId.indexOf(controlId); 
        if (pos >= 0) break; 
    } 
    return aspControlId; 
 
// Handles the row double click event from grid 
function onRowDblClick(sender, args) { 
    var ajaxManager = GetClientId("ajaxManager"); 
    ajaxManager.AjaxRequest("test"); 
    return false; 

Code in front
<telerik:RadAjaxManager ID="ajaxManager" runat="server" OnAjaxRequest="ajaxManager_AjaxRequest" /> 

Code behind
protected void ajaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e) 
    { 
         
    } 

I get a script error stating ajaxManager.AjaxRequest is not a function. I do find the control no problem. Any ideas?

Thanks,

Michael


2 Answers, 1 is accepted

Sort by
0
Michael Dunbar
Top achievements
Rank 2
answered on 20 May 2009, 10:52 AM
Can you use the AJAX Manager directly in a user control or do I need to put that in a master and then use the Proxy? How do I do that without the OnAjaxRequest function on the proxy?

Is there a basic example of how to call a server side function from client side JavaScript any where you can point me to? I don't understand why it does not see .AjaxRequest as a valid function of the AJAX manager.

Help please.
0
Michael Dunbar
Top achievements
Rank 2
answered on 20 May 2009, 12:52 PM
Ah what a dumb ass :) I am only getting the ID of the control as opposed to the control itself of course. Never mind.
Tags
Ajax
Asked by
Michael Dunbar
Top achievements
Rank 2
Answers by
Michael Dunbar
Top achievements
Rank 2
Share this question
or