Add a blank row to asp repeater during ItemDataBound event

Posted on 2009-02-24
Last Modified: 2012-05-06
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

Question by:AIBMass
    LVL 7

    Expert Comment


    Accepted Solution

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in… provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now