Coloring certain rows when filling a listbox

Hello all,

I am using the following code to populate a listbox. I want to color all rows that have either Session.SiteList.SiteID = 0 Or Session.SiteList.Account = 0.

My problem is, it only colors the last row. How do I do this correctly?

Thanks,
Tim

oarderColor = Color.Magenta
lstAccounts.Style.BorderColor = BoarderColor  

lstAccounts.RemoveAllRows 
lstAccounts.ColumnCount=3

lstAccounts.HasHeader =True

lstAccounts.HeaderAt(0)="Site"
lstAccounts.HeaderAt(1)="Acc"
lstAccounts.HeaderAt(2)="Site Name"
lstAccounts.ColumnWidths = "60, 60, 150" //, 90"

Dim Result As Integer = Session.SiteList.getAll(False, "siteno", False)
If Result > 0 Then 
  do until Session.SiteList.RsSiteList.AfterLastRow   // EOF
    Session.SiteList.FillVars
    
    lstAccounts.AddRow (Session.SiteList.SiteID.ToString , Session.SiteList.Account.ToString, Session.SiteList.SiteName.Trim.Titlecase) 
    
    If Session.SiteList.SiteID = 0 Or Session.SiteList.Account = 0 Then 
      Dim Idx As Integer = lstAccounts.LastAddedRowIndex
      lstAccounts.SelectedRowIndex = Idx   // lstAccounts.LastAddedRowIndex
      lstAccounts.SelectedRowColor = BoarderColor
      
    End If
    
    
    Session.SiteList.RsSiteList.MoveToNextRow  // MoveNext
    
  loop
End If

Unfortunately, though it reads like the DesktopTextArea functions, SelectedRowColor is not a “change the color of the selection” function. It’s the property that represents the “selected row highlight color”. You’ll need to use WebListboxStyleRenderer to style individual cells.

Will do Tim,

Thank you,
Tim
Edit that is actually a lot of work since it has to be done to each of the three columns… Oh well, that’s for pointing me in the right direction tho Tim

Tim