This topic is locked
[SOLVED]

 Insert Button For Each Record

8/30/2013 11:23:25 PM
ASPRunnerPro General questions
lefty author

I would like to pass values from row data in one table to the related add fields in another table through a button with url to add page in another table.
I have below fields in Photo Table ( Master Table )

ID

photo_category

photo_description ( dependant upon category )
I would like to click on button on list page ( buttton in each row ) and pass the above two fields data to another table filled in ( In a link url ) within the button to the below table add page. Does not have to be a button a link field woould work be sufficient also.
Display Table ( Details Table )
Add Page:

ID

photo_category

photo_description

Other fields ......
I have gone through the enitre forum and manual and cannot seem to accomplish this. Thought rowdata would do it but can't get it to work.
Any Ideas . Would appreciate.

T
Tim 9/2/2013

I have done this by creating the link in query of the master table.
I'm going to assume the "two fields data" you want to pass are the ID and photo_category fields and I will assume a MSSQL database.
Query for master table:
select

ID,

photo_category,

photo_description,

"Display_Table_add.asp?id=" + ID + "&cat=" + photo_category as AddDetials

from [Photo Table]
Include the AddDetails field on your list page and, in the visual editor, make it a hyperlink. In the properties of the hyperlink field you can select "Display word" and make it "Click here to add details", or whatever.
On the Add page of the details table you can access the passed data fields by "Request.QueryString("id")" and "Request.QueryString("cat")"
I must say, though, this sounds like essentially the same thing as a Master/Details table link on the Tables page. But maybe you have different needs than what that gets you.
I hope this helps.
Good luck!

Tim

lefty author 9/3/2013



I have done this by creating the link in query of the master table.
I'm going to assume the "two fields data" you want to pass are the ID and photo_category fields and I will assume a MSSQL database.
Query for master table:
select

ID,

photo_category,

photo_description,

"Display_Table_add.asp?id=" + ID + "&cat=" + photo_category as AddDetials

from [Photo Table]
And assume

Include the AddDetails field on your list page and, in the visual editor, make it a hyperlink. In the properties of the hyperlink field you can select "Display word" and make it "Click here to add details", or whatever.
On the Add page of the details table you can access the passed data fields by "Request.QueryString("id")" and "Request.QueryString("cat")"
I must say, though, this sounds like essentially the same thing as a Master/Details table link on the Tables page. But maybe you have different needs than what that gets you.
I hope this helps.
Good luck!

Tim



Thanks for the reply
Tried your suggestion . put code above in sql of master record and no hyperlink shows. Blank.

Noticed that hyperlink is grayed out in view as in visual editor .

Basically I just want to autofill fieldso when user clicks on link ( instead of list page - goes to add page with wanted fields already filled in ) on add page.

If I use master / detail link , it defaults to list page of details with all records as it should , but not looking to show details with all records.

In fact didn't want to use master/detail at all here unless ( to creat a link an autofill it is necessary.)

I had done this once before but have forgotton code.
Here is sql in Master table Photos: ( actual field names are below )( Access Database)
SELECT

ID,

Photo_desc,

photo_file,

fldcode,

photo_link,

"Book_Display_add.asp?Id=" + ID + "&fldcategory=" + photo_link AS AddDetails

FROM Photos

ORDER BY photo_link, Photo_desc
Assume "Request.QueryString("fldcategory")" goes in Process Record Values event on details add page Request.QueryString("fldcategory")

T
Tim 9/4/2013

John,
Sorry, I'm not sure what you mean by "put code above in sql of master record and no hyperlink shows". This query just puts together the text string that will be used as a hyperlink.
And on the visual editor, if the field type "Hyperlink" is greyed out you can still select it anyway (although, because this query will return a text string for this field I would think the Hyperlink type would be active as a choice).
The query you have looks correct. It should return a column named "AddDetials". This column will contain the text that is the link to the "add page" of the details table. Then, on the Visual Editor page of the master table, make this field type "Hyperlink" (done in the properties of the field - again, if it's grey, select it anyway).
(I assume in the details table you have a field to hold the master table ID. I'll call it MasterID.)
Then, in the Visual editor go to the "Add page" of the details table and then go to the properties of the MasterID field and make the default value Request.QueryString("id").

On the properties of the photo_category field make the default value Request.QueryString("fldcategory").
I hope this helps.
Good luck.

Tim