Posted on: 9/15/2014 2:51:29 PM | Views : 455


i have a sub to change some label and button visibility in masterpage.
I need to add this sub in each page. (about 10 pages)
Is there any way to store this sub so that I could apply it but do not need copy entire sub in each page?
I tried to add it in a class file in App_code but "Master.findcontrol" got an error.
Public Sub SetVisible() CType(Master.FindControl("lblA"), Label).Visible = False CType(Master.FindControl("lblB"), Label).Visible = False CType(Master.FindControl("lblC"), Label).Visible = False CType(Master.FindControl("imbA"), ImageButton).Visible = False
CType(Master.FindControl("imbB"), ImageButton).Visible = False
CType(Master.FindControl("imbC"), ImageButton).Visible = False
End Sub

Go to the complete details ...