By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

VB-WEB: Adding Subheader to Repeater

P: 17
I may be going at this completely wrong, but this is what I have come up with so far.

I am using a dataset and a repeater to present information. The sample dataset is:

Name, Title, Email, Place
tom, worker, tom@, area1
joe, worker, joe@, area1
bill, leader, bill@, area2
john, worker, john@, area2
steve, worker, steve@, area3
and so on.

I want to display Name, Title and Email in the header row. (Works fine)
I want to group the people by Place (not a problem)

I want the information to be displayed in a table in the following order.

HEADER ROW (got that)
area1 (Place)
(List name title and email) NEXT ROW
(List name title and email) UNTIL ALL area1 are finished THEN
area2 (Place)
(List name title and email) NEXT ROW
(List name title and email) UNTIL ALL area2 are finished THEN
area3 (Place)
(List name title and email) NEXT ROW
(List name title and email) UNTIL ALL area3 are finished AND SO ON

I currently am getting the following.
HEADER ROW (got that)
area1 (Place) NEXT ROW
(List name title and email) NEXT ROW
area1 (Place) NEXT ROW
(List name title and email) NEXT ROW
area2 (Place) NEXT ROW
(List name title and email) NEXT ROW
area2 (Place) NEXT ROW
(List name title and email) NEXT ROW
area3 (Place) NEXT ROW
(List name title and email) NEXT ROW AND SO ON

Is there any way to accomplish what I am trying to do using the repeater? I have read something about possibly putting a datagrid within the <ItemTemplate> tags but have no idea where to start on that one.

Thanks in advance.
Apr 24 '07 #1
Share this Question
Share on Google+
3 Replies


TRScheel
Expert 100+
P: 638
So basically you are trying to sort by Place? but you want sub headers?

so..

Header Info
Subheader (place)
-- information (name, email, etc)
Subheader 2
-- information

Am I right?
Apr 24 '07 #2

P: 17
That is exactly right.
Apr 24 '07 #3

P: 17
Alright, I finally got this figured out. I wanted to post the solution for those that might be curious.

I created the following function and then called it at the top of both the ItemTemplate and the AlternateTemplate (replace place with Office because of the exact field name)

Function checktempOffice(ByVal Office As String)
Dim tempstring As String = ""

If (tempOffice = Office) Then
'Do Nothign
Else
tempOffice = Office
tempstring = "<tr><td colspan=3><b>" & Office & "</b></td></tr>"

End If

Return tempstring

End Function

************************************************** **

Call was with:

<%#checktempOffice(DataBinder.Eval(Container.DataI tem, "Office").tostring)%>


This may or may not be the exact way to do it, but it is working properly.
Apr 24 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.