Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic links

Status
Not open for further replies.

jacob94

Technical User
Dec 5, 2005
161
US
I have a dynamic data region that i created in DMX that displays a recordset from sqlserver. One of the fields is called username. I would like to make each username a hyperlink so a person viewing the report can click on any username and have it redirect to another page passing the username as a parameter.

the new link would be report2.asp (somehow with the parameter sessionusername = (what they clicked on the other page).

username
john
joe
jacob


when user click on a specific name:

etc....


is this possible and how hard to modify my dynamic data region?

ASP
sql server 2000
dmx
 
Just like so...

<%

'If your recordset loop is not included in a table row:

'Open the recordset
'Start the loop

Do While Not rs.EOF

Response.Write "<a href='report2.asp?username=" & rs("Username") & "'>username</a>"

rs.MoveNext
Loop
rs.Close
Set rs = Nothing

%>

<%

'If your recordset loop is included in a table row just add the html elements:

'Open the recordset
'Start the loop

Response.Write "<table>"

Do While Not rs.EOF

Response.Write "<tr><td><a href='report2.asp?username=" & rs("Username") & "'>username</a></tr></td>"

rs.MoveNext
Loop
rs.Close
Set rs = Nothing


Response.Write "</table>"

%>



I don't know sir...I guess its broke.
 
oops the last link should have closed the dimension first:

Response.Write "<tr><td><a href='report2.asp?username=" & rs("Username") & "'>username</a></td></tr>"

I don't know sir...I guess its broke.
 
Once you've got all your links in place you would have to use Request.QueryString to retrieve the value after the ?

eg

<%

rs.Open "SELECT * FROM Users WHERE UserName='" & Request.QueryString("username") & "'", DB

Response.Write("First Name: ") & rs("FirstName") & "<br>"
Response.Write("Surname: ") & rs("Surname") & "<br>"
Response.Write("Username: ") & rs("Username") & "<br>"

rs.Close

Set rs=Nothing
Set DB=Nothing

%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top