This topic is locked

Merging multiple tables into one on client side

5/10/2007 6:03:04 AM
ASPRunnerPro General questions
R
ryn004 author

I'm developing a website which has 4 tables which are technically to be in 1 table, but due to the number of fields I had to split them up.

Is there a way with asprunner that when the client is in add/edit view that the fields of all 4 tables are shown on one page or at least I get "Next Step" instead of "Save" at the bottom, where it will pass on the "id" number of the current record being updated.

J
Jane 5/10/2007

Hi,
you can do it using event.

Proceed to the Events tab, select After record updated event and add following code in it:

Sub AfterEdit()

'** Redirect to another page ****

Response.Redirect "TableName_view.asp?editid1=" & postvalue("editid1")

End Sub



where TableName is your actual table name.
After record added event code is dependent on type of the primary field in your tables.

R
ryn004 author 5/11/2007

Thanks. However instead of TableName_view.asp I'm using TableName_add.asp.
Now imagine there are 2 tables, when the click save on the first TableName1_add.asp the user will be redirected to TableName2_add.asp. The above works ok but I've got stuck on how to pass on the primary key number in the 1st table into a foriegnkey into the 2nd table.

J
Jane 5/11/2007

Hi,
you can save primary key value in the Session variable in the After record updated event:

Session("FieldName") = postvalue("editid1")



And then use Session("FieldName") as default value on the "Edit as" settings dialog on the Visual Editor tab.

R
ryn004 author 5/11/2007

The value in the table 2 field is coming blank. This is what I did:
In asprunner under Event for table 1 I inserted the following code:

Sub AfterAdd()

'** Redirect to another page ****

Session("Property_ID") = postvalue("editid1")

Response.Redirect "table2.asp"

End Sub

and under the Visual Editor for table 2 I assigned the default value of a textfield to:

Session("Property_ID")


What am I doing wrong?

Sergey Kornilov admin 5/11/2007

You use wrong event.
Jane's recommendation applies to AfterEdit event while you trying to use AfterAdd.