This topic is locked
[SOLVED] Get info before import 3/3/2021
ASPRunner.NET General questions

I have an import where I want to run a stored procedure after it is complete and I need to pass that procedure a parameter, which I'd like the user to supply. I was thinking of using the dialog API and have the user select from a dropdown list. The help page has an excellent example (example 2) but I can't figure out how to get the user's selection back to the server so I can set a session variable, which I would then use as the parameter for the stored procedure in the After Import Finished event. If it was a custom button I could put the dialog API code in the client before and then set the variable in the server part, but, since I need it for an import, I was thinking I'd put the popup code in the JavaScript Onload event. But how do I then get the selection from the popup back to the server? Or is there another way to solve this?
Thanks for any help.


admin 3/3/2021

The easiest option to pass something from the dialog to the session variable is to use a custom button. See example #1 at
You can see how we use params["subject"] there which is the value of the subject input box. This way you let the user select one of the options and save it in a session variable.

Tim 3/5/2021

Thank you Sergey. Yes, I can put a button on the import page to capture what I need. I was hoping it would just popup when the page loaded, but this is fine if it's the best way to get data to the server. Thanks.
However, I can't get this to work for a "lookup" type dialog. It works when I don't specify a dialog type, as it is in example #1 (although the help file says to access it via params["subject"], but because this is on the server tab I had to use parameters["subject"]). But I need the user to select from a dropdown. Here is what I tried:
---Client before ----

return Runner.Dialog( {

title: 'Promo Month',

fields: [{

name: 'month',

type: 'lookup',

value: 1,

















ok: 'Save',

cancel: 'Cancel'

--- Server ----

The dialog popups up and allows me to select the month, but the session never gets set on the server. I suspect I have to do something with "controls[0].val()" and maybe "beforeOK:" but I couldn't figure it out. What am I missing?


Tim 3/23/2021

Has anyone used the dialog API to pass a selection from a lookup field to the server? I still can't get this to work.


admin 3/24/2021

The following looks correct:


How do you know it doesn't work? Did you try to print parameters["month"].ToString() in that event.

Tim 3/24/2021

Correct. I print the session to the screen and when the dialog has a dropdown list, the session is empty. If the dialog is just a text field, the session has whatever was typed into the text box.
I can try and create a simple example and publish it to the demo site.


admin 3/25/2021

Yes, but my question wasn't about printing session variables. Did you try to print parameters["month"].ToString() in that event?

Tim 3/25/2021

Yes, I tried to print both. I published a test project to the demo site and submitted a support ticket and got the answer. There are 2 ways to call the dialog API: "Runner.Dialog( params )" and "ctrl.dialog({settings})". I was using the first, which doesn't pass data to the server. It explains this in the help file (not as clearly as "use ctrl.dialog if you want to pass data to the server", but it's in there if you carefully read the entire page).
<br><br>But thanks for the reply; both for attempting to help, and for getting me to come to the new, improved forum site! This is great. I can't wait to try a search!

admin 3/25/2021

Got it, thank you for the update.