M
Michel Couche
Hello!
I am working on an on-line ASP.Net library.
I would like to set up the visibility of some controls programmatically.
My approach is to give an "admin_" prefix to some controls and to define
their visibility by the procedure below ....
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
.....
Call SetUpVisibility_AdminControls(False)
....
End sub
....
....
Sub SetUpVisibility_AdminControls(ByVal Adminlevel As Boolean)
Dim obj_Control As Control
For Each obj_Control In Page.Controls
If Left(obj_Control.ID, 6) = "admin_" Then
Page.FindControl(obj_Control.ID)
obj_Control.Visible = Adminlevel
End If
Next
End Sub
For reason (...), this just does not work and, whatever the value of the
boolean "AdminLevel", the controls are always visible.
Thanks in advance for your support.
Michel
I am working on an on-line ASP.Net library.
I would like to set up the visibility of some controls programmatically.
My approach is to give an "admin_" prefix to some controls and to define
their visibility by the procedure below ....
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
.....
Call SetUpVisibility_AdminControls(False)
....
End sub
....
....
Sub SetUpVisibility_AdminControls(ByVal Adminlevel As Boolean)
Dim obj_Control As Control
For Each obj_Control In Page.Controls
If Left(obj_Control.ID, 6) = "admin_" Then
Page.FindControl(obj_Control.ID)
obj_Control.Visible = Adminlevel
End If
Next
End Sub
For reason (...), this just does not work and, whatever the value of the
boolean "AdminLevel", the controls are always visible.
Thanks in advance for your support.
Michel