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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP table question

Status
Not open for further replies.

Snappy2873

Programmer
Mar 29, 2002
54
US
How do I lock a table into staying one size horizontally?
Here is my code for the search page that works properly. THe problem is that when I search in the "keyword" column the search results explode horizontally outside my limits I've set in the table specs. I just want the results to wrap vertically.
Here is my code:

<!--#INCLUDE FILE="include/functions_inc.asp"-->
<HTML>
<HEAD>
<%
searchtext = Request.Form("searchtext")
searchfield = Request.Form("searchfield")
IF searchtext = "" Then%>
<TITLE>TechLibrary V3.0</TITLE>
<%ELSE%>
<TITLE>TechLibrary V3.0 Search Results for <%=searchtext%></TITLE><%
END IF%>
<script>
//JSCRIPT
function ChangeButton(what)
{
if(what.className == ""){
what.className = "mouseover"
}else{
what.className = ""
}
}
function CheckFields()
{
if(document.frmsearch.searchfield.value==""){
alert("Please select a Category!")
document.frmsearch.searchfield.focus();
}else{
if(document.frmsearch.searchtext.value==""){
alert("Please enter some search criteria!")
document.frmsearch.searchtext.focus();
}else{
document.frmsearch.method="post"
document.frmsearch.action="docsearch.asp"
document.frmsearch.submit();
}
}
}
</script>

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function window_onload()
{
document.frmsearch.searchfield.focus();
}
</SCRIPT>
</HEAD>

<BODY LANGUAGE=javascript onload="return window_onload()">
<FORM ACTION="" METHOD="post" NAME="frmsearch" onSubmit="return false">
<BR>
<%IF searchtext = "" THEN%>
<TABLE>
<TR>
<TD class="_header_">TechLibrary V3.0 Document Search</TD>
</TR>
<TR>
<TD>&nbsp;</TD>
</TR>
</table>
<TABLE>
<TR>
<TD>Category field:<select name="searchfield">
<option value="">
Please select one of the following
<option value="docident">Document Identifier
<option value="doctitle">Document Title
<option value="dockeyword">Keywords
<option value="docloc">Location
<option value="docauthor">Author
</select></TD>
</tr>
<tr>
<TD>Text to search for:<INPUT NAME="searchtext" SIZE=30 MAXLENGTH=64></TD>
</TR>
<TR>
<TD><INPUT TYPE="submit" VALUE="SEARCH" ONMOUSEOVER="ChangeButton(this);" onmouseout="ChangeButton(this);" onclick="CheckFields();" id=submit1 name=submit1>&nbsp;&nbsp;<INPUT TYPE="reset" VALUE="RESET" ONMOUSEOVER="ChangeButton(this);" onmouseout="ChangeButton(this);" id=reset1 name=reset1></div></TD>
</TR>
</TABLE>
<%ELSE%>
<TABLE>
<TR>
<TD class="header">TechLibrary V3.0 Search Results</TD>
</TR>
<TR>
<TD>&nbsp;</TD>
</TR>
</table>
<%
jiggy1 = "SELECT * FROM [tblDocument] "
select case searchfield
case "'docident'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'doctitle'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'dockeyword'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'docloc'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'docauthor'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case else
jiggy2 = "WHERE " & searchfield & " like '%" & searchtext & "%' "
end select
jiggy3 = "ORDER BY docident, doctitle, dockeyword, docloc, docauthor"
stmt = jiggy1 & jiggy2 & jiggy3
call ConnectDB()
Set objRS = objConn.Execute(stmt, , adCmdText)
if not objRS is nothing then
if not objRS.bof and not objRS.eof then
%>

<TABLE width="55%" align="center" cellpadding=2 cellspacing-2 border=1>
<TR>
<TD class="detailsdark">Document Identifier</TD>
<TD class="detailsdark">Title</TD>
<TD class="detailsdark">Keywords</TD>
<TD class="detailsdark">Location</TD>
<TD class="detailsdark">Author</TD>
</TR>
<%do until objRS.EOF%>
<TR>
<TD class="detailslightleft" COLSPAN=1>
<%= objRS.Fields("docident")%>
</TD>
<TD class="detailslightleft" COLSPAN=1>
<%= objRS.Fields("doctitle")%>
</TD>
<TD class="detailslightleft" COLSPAN=1>
<%= objRS.Fields("dockeyword")%>
</TD>
<TD class="detailslight" COLSPAN=1>
<%= objRS.Fields("docloc")%>
</TD>
<TD class="detailslight" COLSPAN=1>
<%= objRS.Fields("docauthor")%>
</TD>
<TD class="detailslight">
<A HREF="return false" onmousedown="javascript:OpenWindow('iamges/docentry.asp')">View Doc entry</A>
</TD>
<TD class="detailslight">
<A HREF="return false" onmousedown="javascript:OpenWindow('images/docentry.asp')">Edit Doc entry</A>
</TD>
<%objRS.Movenext%>
</TR>
<%lOOP%>
</TABLE><%
objRS.CLose
Set objRS = Nothing
else%>
<TABLE>
<TR>
<TD class="detailsdark">Nothing Found!</TD>
</TR>
</table>
<%end if
else%>
<TABLE>
<TR>
<TD class="detailsdark">Nothing Found!</TD>
</TR>
</table><%
end if
call DisConnectDB()
END IF%>
<!--#INCLUDE FILE="include/MenuOptions_inc.asp"-->
<!--#INCLUDE FILE="navigate.asp"-->
</BODY>
</HTML>
 
Check out the properties of the <TABLE> element or use CSS.

PS: You can probably get a better answer in the HTML forum.


Link to HTML forum: forum215
 
like sheco said ...you'll get a much better response. from the html forum; however, a typo is on the 2nd table

<TABLE width="55%" align="center" cellpadding=2 cellspacing-2 border=1>


to (replace - w/=

<TABLE width="55%" align="center" cellpadding="2" cellspacing="2" border="1">
 
CSS is unattached and the table spec fat finger was fixed. You'd think a simple formatting issue wouldnt be sucha headache. Anyway, thanks for the advice!
snappy
 
glad it worked for you snappy...btw what was the fix action?
...so others can see, thanks

Brian
 
Hey Brian,
I've exhausted my efforts to fix this problem to no avail. I've change the table specs in my access db and the column is still huge. I took the CSS out and started from scratch, individually formatting the tags and the "Keyword" column is still a problem. I've used Colgroups, colspan, rowspan, thead, tbody, every format spec possible up to this point and it still wont format properly. The funny thing is that there is an identical column right next to the keyword column(exact same specs) that doesnt have a problem, it wraps the text vertically like it should. Anyway, I'm gonna keep on trying different angles. THanks, snappy
 
Table format update:
mike from the HTML forum supplied this spec for me that fixed a problem I've been agonizing over for a week.
Just add this spec to your <TABLE> tag and it works great:
<TABLE style="table-layout:fixed">
Thanks everyone for all your help!
snappy
 
excellent...glad you got the you needed and posted fix for all to see..thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top