New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Pass Two or More Arguments in ajaxRequest and ajaxRequestWithTarget with the AjaxManager or AjaxPanel

Environment

Product Progress® Telerik® UI for ASP.NET AJAX AjaxManager Progress® Telerik® UI for ASP.NET AJAX AjaxPanel

Description

How can I pass two or more arguments in the ajaxRequest and ajaxRequestWithTarget functions with the Telerik UI for ASP.NET AjaxManager or AjaxPanel?

Solution

By default, the ajaxRequest and ajaxRequestWithTarget functions accept only one argument.

To achieve the desired scenario and pass two or more arguments in the functions:

  1. Join the arguments on the client.

    <div class='tabbedCode'><pre lang="JavaScript"><code>        var arg3 = arg1 + "," + arg2;
    ajaxManager.ajaxRequest(arg3);
    ````
    

  2. Split the arguments on the server in the AjaxManager_AjaxRequest.

    <div class='tabbedCode'><pre lang="C#"><code>        private void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        string argument = (e.Argument);
        String[] stringArray = argument.Split(",".ToCharArray());
    }           
    ````
    

            Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
            Dim argument As String = e.Argument
            Dim stringArray As String = argument.Split(",".ToCharArray())
        End Sub
    
    
    ````
    

See Also

In this article