• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 635
  • Last Modified:

Add a blank row to asp repeater during ItemDataBound event

I have a web form with a Repeater which returns an alphabetically sorted list of names.  Whenever the first letter of the name changes (ie from A to B or B to C) I want to display a blank line in the repeater to make it easier to read this list of 100+ names.  

I have the if statement which catches the change correctly.  I just don't know what code to type to get the blank line.  

I tried response.write("<tr><td><br /></td></tr>"), but this inserted blank lines at the top of the form instead of inside the repeater table.  

What is the correct way to do this?  
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
            If (Left(e.Item.DataItem("CoName"), 1)) <> prevChar And String.IsNullOrEmpty(e.Item.DataItem("CoName")) = False Then
                ' want a break line here
                prevChar = Left(e.Item.DataItem("CoName"), 1)
            End If
        End If

Open in new window

1 Solution
AIBMassAuthor Commented:
Not quite what I needed.  We ended up changing the stored procedure to return a different character to distinguish the alphabetical listings.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now