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:
-
Join the arguments on the client.
<div class='tabbedCode'><pre lang="JavaScript"><code> var arg3 = arg1 + "," + arg2; ajaxManager.ajaxRequest(arg3); ````
-
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
````