|
| |
|
|
sknepp
Posts: 12 Joined: 7/20/2009 Status: offline
|
ASP Employee Directory - 9/6/2009 23:49:10
My ASP employee directory is set up with an excel spreadsheet. When you click on a person's first name it will take you to a second page with more detailed information. However, I want to be able to hyperlink from more fields (LName, or UserID) to return a single record to the results page. When I set up a hyperlink on the LName or UserID field, the results returned include the entire database. Following is the code from the Database Results table. Thank you! <td style="border-top:7px solid #4F2700; border-left:5px solid #FFFFFF; border-right:5px solid #FFFFFF; " bgcolor="#D3D096" valign="top" colspan="3"> <!-- MSCellType="NavBody" --> <div align="center"> <form BOTID="0" METHOD="POST" action="directory.asp"> <input type="hidden" name="fpdbr_0_PagingMove" value=" |< "> <div align="center"> <table BORDER="0"> <tr> <td align="right"><b><font size="2" color="#4F2700"> Search By First Name</font></b></td> <td> <font color="#4F2700"> <input TYPE="TEXT" NAME="FName" VALUE="<%=Server.HtmlEncode(Request("FName"))%>"></font></td> </tr> <tr> <td align="right"><b><font size="2" color="#4F2700"> Sort Results By </font></b></td> <td> <font color="#4F2700"> <input TYPE="TEXT" NAME="SortColumn" VALUE="<%=Server.HtmlEncode(Request("SortColumn"))%>"><font size="1"> (FName, LName, Location or Company)</font></font></td> </tr> </table> <br> <font color="#FFFFFF"> <input TYPE="submit" style="color: #FFFFFF; font-weight: 700; background-color: #24496F"></font><!--webbot bot="SaveAsASP" clientside suggestedext="asp" preview=" " startspan --><!--webbot bot="SaveAsASP" endspan --><input type="hidden" name="fpdbr_0_PagingMove" value=" |< "></form> <table border="1"> <thead> <tr> <th bgcolor="#4F2700" height="28"><b> <font size="2" color="#FFFFFF">Photo</font></b></th> <th bgcolor="#4F2700" height="28"><b> <font size="2" color="#FFFFFF"> <a href="directory.asp?SortColumn=FName"> <font color="#FFFFFF">First Name </font></a></font></b></th> <th bgcolor="#4F2700" height="28"><b> <font size="2" color="#FFFFFF"> <a href="directory.asp?SortColumn=LName"> <font color="#FFFFFF">Last Name </font></a></font></b></th> <th bgcolor="#4F2700" height="28"><b> <font size="2" color="#FFFFFF">Phone</font></b></th> <th bgcolor="#4F2700" height="28"><b> <font size="2" color="#FFFFFF">Cell</font></b></th> <th bgcolor="#4F2700" height="28"><b> <font size="2" color="#FFFFFF">Email</font></b></th> <th bgcolor="#4F2700" height="28"><b> <font color="#FFFFFF" size="2"> <a href="directory.asp?SortColumn=Location"> <font color="#FFFFFF">Location</font></a></font></b></th> <th bgcolor="#4F2700" height="28"> <font size="2" color="#FFFFFF"> <font color="#FFFFFF"> <a href="directory.asp?SortColumn=Company"> <font color="#FFFFFF">Company </font></a> </font> </a></font></b></th> </tr> </thead> <tbody> <!--webbot bot="DatabaseRegionStart" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-columntypes="200,200,200,200,200,200,200,200,200,200,200,200,200,200" s-dataconnection="Database2" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="FALSE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="TRUE" s-recordsource s-displaycolumns="Photo,FName, LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Company" s-criteria s-order s-sql="SELECT * FROM "Employees" WHERE (FName LIKE '%::FName::%') ORDER BY ::SortColumn:: ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="FName=&SortColumn=FName" s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="_fpclass/fpdblib.inc" u-dbrgn1="_fpclass/fpdbrgn1.inc" u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the start of a Database Results region.</font></td></tr>" startspan --><!--#include file="_fpclass/fpdblib.inc"--> <% if 0 then %> <SCRIPT Language="JavaScript"> document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>"); </SCRIPT> <% end if %> <% fp_sQry="SELECT * FROM ""Employees"" WHERE (FName LIKE '%::FName::%') ORDER BY ::SortColumn:: ASC" fp_sDefault="FName=&SortColumn=FName" fp_sNoRecords="<tr><td colspan=13 align=""LEFT"" width=""100%"">No records returned.</td></tr>" fp_sDataConn="Database2" fp_iMaxRecords=0 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_sColTypes="&Photo=200&FName=200&LName=200&UserID=200&Department=200&Phone=200&Extension=200&Cell=200&Email=200&Location=200&Fax=200&Title=200&Address=200&Company=200&" fp_iDisplayCols=13 fp_fCustomQuery=True BOTID=0 fp_iRegion=BOTID %> <!--#include file="_fpclass/fpdbrgn1.inc"--> <!--webbot bot="DatabaseRegionStart" endspan i-checksum="54035" --><tr> <td> <p align="center"><font size="2" color="#000000"> <a href="directory2.asp?Photo=<%=FP_fieldlink(fp_rs,"Photo")%>"> <img border="0" width="40px" src="photos/<%=fp_rs("Photo") & ".jpg" %>"></a></font></td> <td> <p align="center"> <font color="#4F2700" size="2"> <a href="directory2.asp?FName=<%=FP_Fieldlink(fp_rs,"FName")%>"> <font color="#4F2700"> <!--webbot bot="DatabaseResultColumn" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-column="FName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>FName<font size="-1">>></font>" startspan s-ColumnTypes="200,200,200,200,200,200,200,200,200,200,200,200,200,200" --><%=FP_FieldVal(fp_rs,"FName")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="4404" --></font></a></font></td> <td> <p align="center"> <font color="#4F2700" size="2"> <a href="directory2.asp?LName=<%=FP_FieldLink(fp_rs,"LName")%>"> <font color="#4F2700"> <!--webbot bot="DatabaseResultColumn" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-column="LName" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>LName<font size="-1">>></font>" startspan s-ColumnTypes="200,200,200,200,200,200,200,200,200,200,200,200,200,200" --><%=FP_FieldVal(fp_rs,"LName")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="4788" --></font></a></font></td> <td> <p align="center"><font size="2" color="#4F2700"> <!--webbot bot="DatabaseResultColumn" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-column="Phone" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>Phone<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"Phone")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="8388" --></font></td> <td> <p align="center"><font size="2" color="#4F2700"> <!--webbot bot="DatabaseResultColumn" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-column="Cell" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>Cell<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"Cell")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="3721" --></font></td> <td><font size="2" color="#000000"> <font color="#24496F"> </font><a href="mailto:<%=FP_FieldURL(fp_rs,"Email")%>" style="text-decoration: none"><font color="#24496F"><!--webbot bot="DatabaseResultColumn" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-column="Email" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>Email<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"Email")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="8328" --></font></a><font color="#24496F"> </font></td> <td><font size="2" color="#4F2700"> <!--webbot bot="DatabaseResultColumn" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-column="Location" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>Location<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"Location")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="16691" --></font></td><td> <p align="center"><font size="2" color="#4F2700"> <!--webbot bot="DatabaseResultColumn" s-columnnames="Photo,FName,LName,UserID,Department,Phone,Extension,Cell,Email,Location,Fax,Title,Address,Company" s-column="Company" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>Company<font size="-1">>></font>" startspan s-ColumnTypes="200,200,200,200,200,200,200,200,200,200" --><%=FP_FieldVal(fp_rs,"Company")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="13684" --></font></td> </tr> <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" width="100%"><font color="#000000">This is the end of a Database Results region.</font></td></tr>" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"--> <!--webbot bot="DatabaseRegionEnd" endspan i-checksum="62730" --></tbody> </table> </div>
|
|
|
|
swoosh
Posts: 1535 Joined: 5/18/2002 From: Beaver Falls, PA Status: offline
|
RE: ASP Employee Directory - 9/7/2009 1:08:52
quote:
When I set up a hyperlink on the LName or UserID field, the results returned include the entire database Sounds like your not passing a parameter (such as UserID) within the hyperlink so that only results for that particular record will show
_____________________________
Swoooosh Just Do It!
|
|
|
|
sknepp
Posts: 12 Joined: 7/20/2009 Status: offline
|
RE: ASP Employee Directory - 9/7/2009 1:29:04
I am not sure what you mean. Are you saying that somehow the hyperlink doesn't eliminate the other records? The hyperlink code is: directory2.asp?UserID-%3c%25=FP_FieldLink(fp_rs,%22)%25%3e
|
|
|
|
sknepp
Posts: 12 Joined: 7/20/2009 Status: offline
|
RE: ASP Employee Directory - 9/7/2009 16:56:36
"Sounds like your not passing a parameter (such as UserID) within the hyperlink so that only results for that particular record will show " How can I check to see if that is the case?
|
|
|
|
Joe Kauffman
Posts: 211 Joined: 6/9/2004 From: Arizona, USA Status: offline
|
RE: ASP Employee Directory - 9/8/2009 13:37:16
Create a page and name it posttest.asp. Within the body of that page place this code:
<%=request("UserID")%>
<br>
<%=request("Fname")%>
& change this
<form METHOD="POST" action="directory.asp">
to this
<form METHOD="POST" action="posttest.asp">
then test the page again by clicking on one of the links. It should write out the ID and first name of the record you clicked on.
_____________________________
Regards, Joe Kauffman
|
|
|
|
Joe Kauffman
Posts: 211 Joined: 6/9/2004 From: Arizona, USA Status: offline
|
RE: ASP Employee Directory - 9/8/2009 13:45:46
Also, not to knock on your coding, but there is a lot of redundant code in the page. More code = harder to troubleshoot. This page could be 1/3 the size (coding wise) than it is now by using better ASP scripting. I highly recommend researching some of Spooky's samples and reading some online resources. 4guysfromrolla.com is a great site to start with. It's easy to get overwhelmed so use the search feature for specific help.
_____________________________
Regards, Joe Kauffman
|
|
|
|
sknepp
Posts: 12 Joined: 7/20/2009 Status: offline
|
RE: ASP Employee Directory - 9/8/2009 14:12:43
Thank you Joe. I will give that a try. This is my first attempt at asp. Since I am still learning how to combine things and getting the code right, I am sometimes afraid to delete. Thanks for the suggestion though, because that is how I learn what I should be doing as opposed to what I have taught myself.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|