Forum Moderators: open

Message Too Old, No Replies

Set COLUMN WIDTH on web datasheet

Reduce text box from 255 to 50

         

StephenRKnight

3:43 pm on Nov 11, 2003 (gmt 0)

10+ Year Member



Hello

Using Access 2000 I have one
field that is set to 255 characters.

When the table is displayed on the
web page the column stretches to
the max 255 chars.

How can I control the WIDTH of a column?

Ideally a max display of 50 chars,
so that text flows.

I need to set COLUMN WIDTH at the SELECT (below)

FreeadsDatabase10.Query = "SELECT Image, Make, Model, Private_Trade, Description, Price, email, County, Location FROM Vehicles WHERE Model='" & strModel & "' AND County='" & strCounty & "'"

I know usually this would be via HTML but
my problem is that the table is produced on
the fly - on the code I have got I have
located what section 'forms' the table but I
don't know how to adjust it.

I have included
<!--#Include file="FreeadsDatabase10.asp"-->
below.

I have been trying for days but
can't get to grips with this one.

Thank you in advance for any help you can provide.

Regards, Stephen

__________________
Return_Results.asp
------------------

'sub that displays everything in a table
'sub that displays everything in a table
Public Sub DisplayResults()
Dim arrResults
Dim strOutput
Dim rowCounter
Dim colCounter
Dim numCols
Dim numRows
Dim strBgColor
Dim thisField
Dim showBlank
Dim showNull
'define variables
showBlank = "&nbsp;"
showNull = "-null-"
'default value for records per page
If i_RecordsPerPage = "" Then
i_RecordsPerPage = 5
End If
'call internal function
arrResults = GetRecordArray(i_RecordsPerPage)
'#of rows and columns
If IsArray(arrResults) Then
numCols = UBound(arrResults, 1)
numRows = UBound(arrResults, 2)
strOutput = "<table border=""1"" cellpadding=""" _
& i_CellPadding & """ cellspacing=""" & i_CellSpacing & """ " _
& "borderColorLight=""#666666"" borderColorDark=""#ffffff"">" _
& "<tr><td valign=""top"" colspan=""" & (numCols + 1) _
& """ align=""center"" bgcolor=""#CCCCCC"">" _
& GetRecordPositionHTML() & "</td></tr>" _
& "<tr>" & i_Titles & "</tr>"
For rowCounter = 0 To numRows
If rowCounter Mod 2 Then
strBgColor = i_AlternateRowColor
Else
strBgColor = i_RowColor
End If
strOutput = strOutput & "<tr>" & vbcrlf
For colCounter = 0 To numCols
thisField = arrResults(colCounter,rowCounter)
If IsNull(thisfield) Then
thisField = showNull
End If
If Trim(thisfield) = "" Then
thisField = showBlank
End If
strOutput = strOutput & "<td valign=""top"" bgcolor=""" & strBgColor & """>" _
& thisField & "</td>" & vbcrlf
Next
strOutput = strOutput & "</tr>" & vbcrlf
Next
If (i_TotalPages > 1) Then
strOutput = strOutput & "<tr><td valign=""top"" align=""left"" colspan=""" _
& (numCols + 1) & """ bgcolor=""#cccccc"">" & GetPagingHTML() & "</td></tr>"
End If
strOutput = strOutput & "</table>"
Response.Write(strOutput)
Else
Exit Sub
End If
End Sub

[edited by: Xoc at 2:25 am (utc) on Nov. 13, 2003]

Xoc

2:24 am on Nov 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In your code, you need to add a width attribute to your <td> tags.

<td valign=""top"" width="50px" colspan=""" & (numCols + 1) _
& """ align=""center"" bgcolor=""#CCCCCC"">" _
& GetRecordPositionHTML() & "</td>

I am going to trim the rest of your code down to the relevant part.

StephenRKnight

1:26 pm on Nov 13, 2003 (gmt 0)

10+ Year Member



Thank you Xoc

StephenRKnight

1:54 pm on Nov 13, 2003 (gmt 0)

10+ Year Member



Xoc - I just tried that - it didn't work.
What it did was to shift the heading i.e.
'Results 1 - 10 of 36' to the left.

Thanks anyway - Stephen

Xoc

5:16 pm on Nov 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add a width attribute in each place that you have a <td> tag being generated.