Posted on: 7/4/2015 12:54:59 PM | Views : 711

I created a function to change drop down list boarder color as the code below and applied it in page_load event.
There are many drop down lists which first item is "{Select}" but this function always return 0.
Is there something going wrong?
Public Function DDLCheckErrorValidSelect(ByVal cc As ControlCollection) As Integer 'to use DDLCheckErrorValidSelect(Me.Controls) Dim i As Integer = 0 Dim c As Control For Each c In cc If TypeOf c Is DropDownList Then If CType(c, DropDownList).SelectedValue = "{Select}" Then CType(c, DropDownList).BorderColor = Color.Red i = i + 1 Else CType(c, DropDownList).BorderColor = Nothing End If End If Next c Return i End Function 

Go to the complete details ...