Skip to main content
May 7, 2007
Question

Display text when GroupID Changes

  • May 7, 2007
  • 1 reply
  • 183 views
I've got an asp recordset pulling from a sqldb. Each row from the db includes a GroupId, indicating which group the row belongs too. At each change in GroupID, I'd like to display a header to introduce that group. How do I tell the asp page to display the header text when the GroupID changes from 1 to 2 or from 3 to 4, etc.
This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
May 7, 2007
If the header information is already included in the recordset then the code
is relatively simple and you do something like this.

Above the repeat region place this code

<% dim testID, thisID
testID = 0
%>

Then in the repeat region where you want the header you do the following

<%
thisID = recordset.field.item("GroupID").value
if testID <> thisID then
response.write recordset.field.item("HeaderName").value
end if
testID = thisID
%>

However if the heading are not in the database but rather you want to enter
them then the code inside the repeat region would change like this

<%
thisID = recordset.field.item("GroupID").value
if testID <> thisID then
Select Case thisID
Case 1
response.write ("Header 1 Name")
Case 2
response.write ("Header 2 Name")
End Select
testID = thisID
%>

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Lucky Kitty" <webforumsuser@macromedia.com> wrote in message
news:f1ndl3$cm3$1@forums.macromedia.com...
> I've got an asp recordset pulling from a sqldb. Each row from the db
> includes
> a GroupId, indicating which group the row belongs too. At each change in
> GroupID, I'd like to display a header to introduce that group. How do I
> tell
> the asp page to display the header text when the GroupID changes from 1 to
> 2 or
> from 3 to 4, etc.
>
>