I have a table displaying the list of vendors from the database.
I have to select one row (vendor details).

For VendorID:
------------------------Start---------------------
<table>
<tr>
<td>Name</td>
<td>Telephone</td>
<td>Email</td>
</tr>
<%do while not rs.eof%>
<tr>
<td onClick="HighLightTR('#cccccc','cc3333');"><input type="hidden" name="vendorid" value="<%=rs("VendorID")%>"><%=rs("Name")%></td>
<td><%=rs("Tel")%></td>
<td><%=rs("Email")%></td>
</tr>
<%rs.movenext
loop%>
</table>
--------------------------End-------------------------

The page also has the PropertyID which comes from the previous page.
For PropertyID:

-------------------------Start------------------------
<input type="hidden" name="propid"> value="<%=request.Form("propid")%>">
--------------------------End-------------------------

The [vendor] record selected is highlighted (i did not put the javascript script for highlighting in here). If the user click the button (below) or an image link, the 'PropertyID' and 'VendorID' will be passed on to the next page, then display the details of the vendor selected.

For button:
-------------------------Start-------------------------
<input type="button" value=" Select " onClick="onClick="window.location.href='select_owner_update.asp?propid=<%=ra("PropertyID")%>&vendorid=<%=rs("VendorID")%>';"">
--------------------------End--------------------------

Would that be possible? :?: How? :-| Can somebody help me with this problem?

Have a nice day!

Lots of thanks,
Francis

yes it is possible,
Below is the code you can use.

<table>
<tr>
<td>Name</td>
<td>Telephone</td>
<td>Email</td>
</tr>
<%do while not rs.eof%>
<tr>
<td onClick="HighLightTR('#cccccc','cc3333');"><input type="hidden" name="vendorid" value="<%=rs("VendorID")%>"><%=rs("Name")%></td>
<td><%=rs("Tel")%></td>
<td><%=rs("Email")%></td>
<td>
<input type="hidden" name="propid"> value="<%=request.Form("propid")%>">
<input type="button" value=" Select " onClick="onClick="window.location.href='select_owner_update.asp?propid=<%=request.form("PropertyID")%>&vendorid=<%=rs("VendorID")%>';"">
</td>
</tr>
<%rs.movenext
loop%>
</table>

Also you cam ommit the following line of code from ur page.

<input type="hidden" name="propid"> value="<%=request.Form("propid")%>">

I am also confused if the propid will be same throughout the page? If it is same then above code will work fine, If not then tell me will it come from database? or from the Form Collection?
thanks

hi,

just thanking you for the reply. :surprised
i just hope there's a way i can put a single button that can be used to transfer the IDs of whichever record selected :sad:, just like a datagrid and a button in visual basic.

more power to you & daniweb!!

francis

You can get selected one record if u place all the records in a single form and place a radio button with each record with the same name and in the value field u set the ID for that record. Now Place one Submit button and when it is submitted you can get the Radio button value and do whatever u want...
I hope this may help u!!

hi again,

sorry if you find me stubborn :o but ah, hope this would be my last question regarding this. the code's ok now. :)
well actually, i would like to try something different. inside the do while loop of the records, can i assign an id that also loops for each record? like an incremeting numeric value, thus will become a unique id for each record. so what will be passed to the action page is the unique id of the record selected? ;)

wud that be possible?
thanks a lot & more power!!

spidey

yes u canhave a variable incrementing each time the record changes under the loop. Also u can concatinte that variable with the ID coming from the database
like

Dim rd
rd=1
while NOT(RS.EOF)
  rd=rd+1
  rd=  RS("id") & rd
RS.movenext
wend

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.