943,931 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 2414
  • ASP RSS
Sep 30th, 2005
0

bu

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
spidey is offline Offline
53 posts
since Aug 2005
Nov 6th, 2005
0

Re: bu

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

ASP Syntax (Toggle Plain Text)
  1. <table>
  2. <tr>
  3. <td>Name</td>
  4. <td>Telephone</td>
  5. <td>Email</td>
  6. </tr>
  7. <%do while not rs.eof%>
  8. <tr>
  9. <td onClick="HighLightTR('#cccccc','cc3333');"><input type="hidden" name="vendorid" value="<%=rs("VendorID")%>"><%=rs("Name")%></td>
  10. <td><%=rs("Tel")%></td>
  11. <td><%=rs("Email")%></td>
  12. <td>
  13. <input type="hidden" name="propid"> value="<%=request.Form("propid")%>">
  14. <input type="button" value=" Select " onClick="onClick="window.location.href='select_owner_update.asp?propid=<%=request.form("PropertyID")%>&vendorid=<%=rs("VendorID")%>';"">
  15. </td>
  16. </tr>
  17. <%rs.movenext
  18. loop%>
  19. </table>


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

ASP Syntax (Toggle Plain Text)
  1. <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
Reputation Points: 9
Solved Threads: 1
Junior Poster in Training
msaqib is offline Offline
91 posts
since Sep 2004
Nov 7th, 2005
0

Re: bu

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 , just like a datagrid and a button in visual basic.

more power to you & daniweb!!

francis
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
spidey is offline Offline
53 posts
since Aug 2005
Nov 7th, 2005
0

Re: bu

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!!
Reputation Points: 9
Solved Threads: 1
Junior Poster in Training
msaqib is offline Offline
91 posts
since Sep 2004
Nov 8th, 2005
0

Re: bu

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
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
spidey is offline Offline
53 posts
since Aug 2005
Nov 8th, 2005
0

Re: bu

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
[code]Dim rd
rd=1
while NOT(RS.EOF)
rd=rd+1
rd= RS("id") & rd
RS.movenext
wend
[code]
Reputation Points: 9
Solved Threads: 1
Junior Poster in Training
msaqib is offline Offline
91 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: updating records using asp and mysql
Next Thread in ASP Forum Timeline: how to display an attached image file in email





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC