I have implemented a color picker control in a web forms project and would like to make sure that CSS/JS is loaded maximum once. I have tried the following:
Protected Shared _clientNeeded As Boolean = True
Public Sub NeedClient()
If (_clientNeeded) Then
_clientNeeded = False
Else
Return
End If
'Loading the client-side
End Sub
The problem is that after building, _clientNeeded
is true at first but then becomes false and will be false forever, so Shared, as my try did not fulfill my goal. So, how could I make sure that loading the client-side will occur if there are color pickers, but not more than once.