This topic is locked
[SOLVED]

Redirect to the Print page of the record just added

12/4/2023 10:55:58 PM
ASPRunner.NET General questions
S
SaulHulse author

Hi, I would like to implement this option.

looks like in PHPrunner the code is this:

header("Location: Cars_print.php?a=print&selection[]=".$keys["ID"]);

exit();


in ASPrunner I have soemthing like this:

MVCFunctions.HeaderRedirect("new_request", "print", "mastertable=orders&masterkey1=" + values["RequestID"].ToString());
MVCFunctions.Exit();

The problem with this code is redirect to the print view with all the records, not the record just added.

fhumanes 12/5/2023

I'm sorry, I don't know asp and I can't write the code. https://fhumanes.com/blog/guias-desarrollo/guia-14-phprunner-utilizar-varias-paginas-de-print/

I think what you need is in this example. JavaScript is the same for the 2 languages.

Greetings,
fernando

T
Tim 12/5/2023

I'm not sure if this is your situation, but I had problems accessing the ID field of newly created records when the ASPRunner query was using a DB view instead of a table. I opened a ticket with support and this is the response I got:

>>>>>>>>

this happens because your database doesn't report the ID field in the view to be autoincremented.
ASPRunner relies on this database provided info to decide if it should to read the newly added ID field value or not.

You can fix it updating this info manually with custom code.
Add this line to the After Table Initialized event:

GlobalVars.tables_data[table]["ID"]["AutoInc"] = true;

where ID is your actual field name.
<<<<<<<<<

Once I did that, I was able to access the ID field in my "After record added" events.

Good luck.
Tim

S
SaulHulse author 12/5/2023

Hi, Guys.
Thanks, for your replay I figure it out.

Is very similar to PHPrunner.

in the After record added event you need to write this

MVCFunctions.HeaderRedirect("TableName", "print", "selection[]=" + values["ID"].ToString());
MVCFunctions.Exit();

It work like charm. :D

I will mark it as solve it