Hello, Im using asp.net and VB.net 2.0 I try to change de properte Visible to a LinkButton
LinkButton.Visible = True
But the control keep the Visible state, in debug i try to change the property to diretly from the control but dot work, the Visibleproperty dont change.
Can you post some of the code? Make sure that if the linkbutton is in a container, that the container is also visible. For example: if it's in a panel, the panel must be visible as well for the linkbutton to be visible. Also, don't forget that you also need
to have the Text property set in order for it to be visible.
Don't forget to mark useful responses as Answer if they helped you towards a solution.
When i try ctrLink.Visible = True the control keep the False value. Wallways.
this code is in the PageBase: i have a base page and all other pages inherits for this page.
Public Sub verificarPermisos(ByVal usuarioID As Integer)
Dim objUsuariosBackOffice As New IBCL.TBL_USUARIOS_BACKOFFICE
If (objUsuariosBackOffice.LoadByPrimaryKey(usuarioID)) Then
Dim objPermisos As New IBCL.RolesBackOffice
Dim dt As Data.DataTable = objPermisos.getPermisosByRolID(objUsuariosBackOffice.UsrB_I_Rol)
For Each row As Data.DataRow In dt.Rows
Dim ctr As WebControl = Nothing
Dim controlID As String() = row("Cat_V_Comentarios").ToString.Trim.Split("|")
For i As Integer = 0 To controlID.Length - 1
ctr = buscarControl(controlID(i)) /* this method implements the FindControl(String controlID) method, and its work */
If (Not ctr Is Nothing) Then
If (row("Asignado")) Then
If (TypeOf (ctr) Is Button) Then
Dim ctrButton As Button = CType(ctr, Button)
ctrButton.Visible = True
ElseIf (TypeOf (ctr) Is LinkButton) Then
Dim ctrLink As LinkButton = CType(ctr, LinkButton)
ctrLink.Visible = True
End If
Else
If (TypeOf (ctr) Is Button) Then
Dim ctrButton As Button = CType(ctr, Button)
ctrButton.Visible = False
ElseIf (TypeOf (ctr) Is LinkButton) Then
Dim ctrLink As LinkButton = CType(ctr, LinkButton)
ctrLink.Visible = False
End If
End If
End If
Next
Next
End If
End Sub
If (Not ctr Is Nothing) Then
If (row("Asignado")) Then
If (TypeOf (ctr) Is Button) Then
Dim ctrButton As Button = CType(ctr, Button)
ctrButton.Visible = True
ElseIf (TypeOf (ctr) Is LinkButton) Then
Dim ctrLink As LinkButton = CType(ctr, LinkButton)
ctrLink.Visible = True
End If
Else
If (TypeOf (ctr) Is Button) Then
Dim ctrButton As Button = CType(ctr, Button)
ctrButton.Visible = False
ElseIf (TypeOf (ctr) Is LinkButton) Then
Dim ctrLink As LinkButton = CType(ctr, LinkButton)
ctrLink.Visible = False
End If
End If
End If
Have your debug above part code ? What's the result?
Best Regards.
Molly
It's time to start living the life you are imagined.
jkarlos06
Member
2 Points
3 Posts
LinkButton.Visible dont work
Nov 10, 2012 12:36 AM|LINK
Hello, Im using asp.net and VB.net 2.0 I try to change de properte Visible to a LinkButton
LinkButton.Visible = True
But the control keep the Visible state, in debug i try to change the property to diretly from the control but dot work, the Visibleproperty dont change.
please help me.
Thanks
markfitzme
All-Star
15343 Points
2358 Posts
Re: LinkButton.Visible dont work
Nov 10, 2012 12:49 AM|LINK
Can you post some of the code? Make sure that if the linkbutton is in a container, that the container is also visible. For example: if it's in a panel, the panel must be visible as well for the linkbutton to be visible. Also, don't forget that you also need to have the Text property set in order for it to be visible.
oned_gk
All-Star
35808 Points
7313 Posts
Re: LinkButton.Visible dont work
Nov 10, 2012 06:17 AM|LINK
The default visible property value is true, when you change to true will no effect.
Suwandi - Non Graduate Programmer
ggaurav
Member
529 Points
218 Posts
Re: LinkButton.Visible dont work
Nov 10, 2012 06:20 AM|LINK
By Default LinkButton.Visible = True so it not affect. To see change LinkButton.Visible = False So you able to see changes
Hope it helps.
-Gaurav Bhandari
=======================================
If this post is useful to you, please mark it as answer.
jkarlos06
Member
2 Points
3 Posts
Re: LinkButton.Visible dont work
Nov 12, 2012 01:18 PM|LINK
this is my code, sorry for the spanglish.. lol
When i try ctrLink.Visible = True the control keep the False value. Wallways.
this code is in the PageBase: i have a base page and all other pages inherits for this page.
Public Sub verificarPermisos(ByVal usuarioID As Integer) Dim objUsuariosBackOffice As New IBCL.TBL_USUARIOS_BACKOFFICE If (objUsuariosBackOffice.LoadByPrimaryKey(usuarioID)) Then Dim objPermisos As New IBCL.RolesBackOffice Dim dt As Data.DataTable = objPermisos.getPermisosByRolID(objUsuariosBackOffice.UsrB_I_Rol) For Each row As Data.DataRow In dt.Rows Dim ctr As WebControl = Nothing Dim controlID As String() = row("Cat_V_Comentarios").ToString.Trim.Split("|") For i As Integer = 0 To controlID.Length - 1 ctr = buscarControl(controlID(i)) /* this method implements the FindControl(String controlID) method, and its work */ If (Not ctr Is Nothing) Then If (row("Asignado")) Then If (TypeOf (ctr) Is Button) Then Dim ctrButton As Button = CType(ctr, Button) ctrButton.Visible = True ElseIf (TypeOf (ctr) Is LinkButton) Then Dim ctrLink As LinkButton = CType(ctr, LinkButton) ctrLink.Visible = True End If Else If (TypeOf (ctr) Is Button) Then Dim ctrButton As Button = CType(ctr, Button) ctrButton.Visible = False ElseIf (TypeOf (ctr) Is LinkButton) Then Dim ctrLink As LinkButton = CType(ctr, LinkButton) ctrLink.Visible = False End If End If End If Next Next End If End Submolly_c
Participant
1590 Points
401 Posts
Re: LinkButton.Visible dont work
Nov 19, 2012 08:25 AM|LINK
Have your debug above part code ? What's the result?
Molly
It's time to start living the life you are imagined.