I have a control in an update panel, its a listbox. On SelectedIndexChanged of the listbox I have a simple routine to change the backcolor of some of the items in the box (see code attached). For some reason, this code redraws the whole page, annoying the users. Interesting though that this doesn't happen when I am debugging locally, nor does it happen in firefox - only in IE on the server.
Any ideas what could be happening?
Protected Sub lbUp_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles lbUp.SelectedIndexChanged
ChangeBackColorIfImplied()
End Sub
Protected Sub ChangeBackColorIfImplied()
Dim SelectedNum As Integer = -1
Dim SelectedString As String = ""
Dim StringofUps As String = ""
lblUpInfo.Text = ""
Dim i As Integer
For i = 1 To lbUp.Items.Count - 1
If lbUp.Items(i).Selected Then
StringofUps = StringofUps & lbUp.Items(i).Value
lbUp.Items(i).Attributes.Add("style", "background-color#FFFFFF")
End If
Next i
Dim Flag As Boolean = False
Dim mylistitem As ListItem
For Each mylistitem In lbUp.Items
Dim ListItemString As String = mylistitem.Value
If InStr(StringofUps, ListItemString) > 0 Then
If StringofUps <> ListItemString Then
mylistitem.Attributes.Add("style", "background-color:#99FFFF")
lblUpInfo.Text = "All entities and people highlighted in light blue will also receive this communication"
End If
Else
mylistitem.Attributes.Add("style", "background-color:#FFFFFF")
End If
Next
End Sub