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

RadConfirm submit with multiple arguments

1 Answer 115 Views
Window
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 24 Aug 2012, 07:13 PM
This has to be a super simple answer...I'm just not finding it.  I'm using the below from code behind to display the RadConfirm window.

aeWindowManager.RadConfirm("Are you sure you want to remove?", "InitiateAjaxRequest", 330, 100, null, "Confirm Remove");

Once a choice is made in the RadConfirm window, this javascript function is called...

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">

function InitiateAjaxRequest(arguments) {
var ajaxManager = $find("<%= aeAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest(arguments);
}

</script>
</telerik:RadCodeBlock>

I can then handle the response using this in the code behind...

protected void aeAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
      //logic here
}

I'm able to access the bool value of the RadConfirm choice using e.Argument.  My problem here is that I need to pass multiple parameters to aeAjaxManager1_AjaxRequest instead of just true or false.  I have no problem splitting a comma seperated string here but I'm not sure to add the multiple arguments to pass to the AjaxRequest.  In this particular case I need to pass the bool value of the selection along with 2 other strings.  I've tried this...

aeWindowManager.RadConfirm("Are you sure you want to remove?", "InitiateAjaxRequest('string1')", 330, 100, null, "Confirm Remove");

...and it works but I loose the bool response from the radconfirm window.  I need to capture the response as well as specify 2 strings.

Please advise how I should go about this.  Your time is much appreciated!!

 

 

 


1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 27 Aug 2012, 12:13 PM
Hi Justin,

It depends on the place where these strings originate.

If you get them via JavaScript in the browser then you can get them in the InitiateAjaxRequest function, concatenate the strings before passing them as the argument to ajaxRequest(). I would use another, rarely used symbol like "|", but this is not very relevant.

If these strings originate in the code-behind you can inject a JavaScrtipt variable that will initialize them. See how to do this in this help article.

Generally, the callback function of the predefined dialogs only takes one argument - the result from the dialog. Passing more is not supported, so you should either use global variables, hidden fields, session variables or some other method you find suitable for your scenario.

Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Justin
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or