Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Problems with a redirect

Author  Topic 

MarkGG
Yak Posting Veteran

53 Posts

Posted - 2005-08-10 : 09:33:40
Ok this is somewhat of a complicated problem. I have a main table that contains a bunch of entries and their type, either people, town, or facility. Main table just assigns an indentity number, and then stores say 'Mark' and 'People'. After the main table I have a table for people, town and facility that has the specific details for each entry.

I made a quicksearch function which allows people to search all of the entries in the entire database. The page works by searching the main table and showing all results that match the query. After I produce the quick results I want the user to be able to click on one of the entries and go to the details page for that entry. My problem is the dtails pages are all different from eachother so I need a way for the system to differentiate and redirect based on the type of entry the user has selected.

Here is the results page code:


<HTML>
<head>

<%
Dim con,sql,constring, rs
Set con = Server.CreateObject("ADODB.Connection")
%>

<!-- #include file="Styles.css" -->
<!-- #include file="dbConnect.ssi" -->

<%
set objRS=Server.CreateObject("ADODB.recordset")
'I open my connection
con.Open dbConnect
%>

</head>

<body bgcolor=#133F54 link="blue" vlink="blue" alink="blue">

<center>
<font size="4" color=#CCFFFF><b>QuickSearch Results</b></font>
<hr width = 50% size =4>
</center>

<br>

<center>
<font color=#3399AA>
Listed below are all the QuickSearch results matching your specifications
</font>
</center>

<br><br>

<center>
<table border = "2" bgcolor="white">
<th>Choose</th><th>Entry Name</th><th>Entry Type</th>
<%
Dim tName
tName = (Trim(request.form("searchq")))
SQL = "Select * from main where NAME like '%" & tName & "%' order by NAME"
objRS.Open SQL, dbConnect
Do While Not objRS.EOF
%>
<tr>
<td><center><input type="checkbox" name="Select type">
<td><input type="text" readonly size=40 name="SearchName" value="<%=objRS("Name")%>" onClick="DetailRedirect()">
<td><input type="text" readonly name="SearchType" value="<%=objRS("Type")%>">
</tr>
<%
objRS.MoveNext
Loop
objRS.Close
con.Close
set con = nothing
%>
</table>

<br>

<table border ="2" bgcolor="white">
<tr><td><center><input type="button" name="Back" value="Back" onClick="history.back()"></center></td></tr>
</table>
</center>

</body>
</HTML>


So basically after it has loaded, I want it to go to pdetails if the user clicked on a person, or tdetails if they click on a town etc etc.
   

- Advertisement -