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

Calling server side method from Javascript

2 Answers 242 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
James Crane
Top achievements
Rank 1
James Crane asked on 12 Feb 2009, 03:21 PM
Hi,

Has anyone had any experience using RadAjax to call a server side function?

I have a situation with a Javascript confirm button, and if 'OK' is clicked I need to execute a method in the code behind. I am aware of a ways to 'hack' this, but I was interested if the AjaxManager offered a neater solution?

Thanks
JC

2 Answers, 1 is accepted

Sort by
0
Giorgio
Top achievements
Rank 1
answered on 12 Feb 2009, 04:02 PM
I think that you could use

//aspx
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            </telerik:RadAjaxManager>

//client side
    function ToolbarButtonClick(sender, args){
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest("test");
        return false;
    }


//server side
    Public Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As AjaxRequestEventArgs)
        Select Case e.Argument
            Case "Send"
' something
        End Select
    End Sub

0
James Crane
Top achievements
Rank 1
answered on 12 Feb 2009, 04:16 PM
Thanks Giorgio,

I will take a look at that.
Tags
Ajax
Asked by
James Crane
Top achievements
Rank 1
Answers by
Giorgio
Top achievements
Rank 1
James Crane
Top achievements
Rank 1
Share this question
or