I have two user controls that need to add a class atribute to the body tag of my page, however they currently over write one another if I just use
Body.Attributes.Add("class","value")
So I need to check if the class attribute exsists and if it already contains the value Im going to add.
If Not Body.Attributes("class").Contains("value") Then
Body.Attributes.add("class", Body.Attributes("class") + " " + "value")
End If
Thanks for you time, any help gratefully received.
EDIT:
The contain constraint doesnt return the expected value, resulting the the class not been concatinated,
Example:
add class “dog” then I a different instance of the same control tries to add “dog” but the contains(“dog”) returns false
After a little more coding I tried using Indexof() the value I was searching for. This allowed me to know if the class attribute contained the value already.