Apply Webstyle to Cell after SelectionStyle


I try to apply a webstyle to a cell after in a click event. I have this code:

Label1.Text = "CellClick(" + CStr(Row) + "," + CStr(Column) + ")" Me.CellStyle(Row, Column) = lbCellSelected

The text is set on the label, so the event is fired as normal. But the cellstyle is never set.
BUT: It does work when there is no SelectionStyle set on the weblistbox. But it doesn’t if there is a webstyle assigned to it.

What I try to do: No style for the selected row (text: black, background: white)
And then set the style to the cell as it was a default rowselection (text: white, background: blueish)

Are setting SelectionStyle and CellStyle not compatible?


I found the problem myself. The SelectionChanged event is raised after the cellclick. So the style is just overwritten by SelectionStyle.
Just loop over all rows and deselect them in the SelectionChanged event and everything works.