Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Display text when GroupID Changes

Guest
May 07, 2007 May 07, 2007
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.
TOPICS
Server side applications
184
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 07, 2007 May 07, 2007
LATEST
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.
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines