| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ASP -- formatting/display first record differently
I am an amateur programmer, developing my own personal site. I have been picking up ASP, ADO, SQL, VBScript bit by bit over the last two weeks and learning has been mostly through trial and errors.
How do I apply a different formatting to the first headline of the recordset. I have already created the necessary classes in the stylesheet. <%rs.MoveFirst do while not rs.eof ' Writes the links to the newly created pages in the browser response.write "<a href='" & rs("ID") & "_" & "features" & month(date) & "_" & year(date) & ".htm'>" & "<p class='menuhead2'>" & rs("Headline") & "</p>" & "</a>" & "<p class='menuintro'>" & rs("Blurb") & "</p>" rs.movenext loop %> |
|
#2
|
||||
|
||||
|
Hi
Try: Code:
<%
int_Counter = 0
rs.MoveFirst
do while not rs.eof
' Writes the links to the newly created pages in the browser
If int_Counter = 0 Then
' First row -- do something to format the line here
End If
response.write "<a href='" & rs("ID") & "_" & "features" & month(date) & "_" & year(date) & ".htm'>" & "<p class='menuhead2'>" & rs("Headline") & "</p>" & "</a>" & "<p class='menuintro'>" & rs("Blurb") & "</p>"
int_Counter = int_Counter + 1
rs.movenext
loop
%>
|
|
#3
|
|||
|
|||
|
Many thanks for responding. I resolved it with the following:
'WRITE FIRST HEADLINE WITH SPECIAL FORMATTING rs.Movefirst act.WriteLine(" <p class='byline'>" & rs("section") & "</p>" ) act.WriteLine(" <p class='menuhead1'>" & rs("Headline") & "</p>" ) act.WriteLine(" <p class='menuintro1'>" & rs("Blurb") & " | " & "<a href='" & rs("ID") & "_" & "topstory" & month(date) & "_" & year(date) & ".html'>" & "Read</a></p>") rs.Movenext 'WRITE SUBSEQUENT HEADLINEs WITH DIFFERENT FORMATTING do while not rs.eof act.WriteLine(" <p class='byline'>" & rs("section") & "</p>" ) act.WriteLine(" <p class='menuhead2'>" & rs("Headline") & "</p>" ) act.WriteLine(" <p class='menuintro'>" & rs("Blurb") & " | " & "<a href='" & rs("ID") & "_" & "topstory" & month(date) & "_" & year(date) & ".html'>" & "Read</a></p>") rs.movenext loop Best regards Quote:
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > ASP -- formatting/display first record differently |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|