Reputation: 990
I have this piece of ASPX code
<asp:Label id="TESTLBLTEST" runat="server" text="Can you see me Label" Visible="<%# DisplayVisibleFalse() %>"></asp:Label>
<div id="div_HID_IntermediateInfos" runat="server" style="display: <%= DisplayNone() %>">
Can you see me DIV?
</div>
And these are code-behind functions:
Public Function DisplayNone() As String
Dim OutShow As String = ""
If csFunc.getUserHTTP = "myUname" Then
OutShow = "block"
Else
OutShow = "none"
End If
Return OutShow
End Function
Public Function DisplayVisibleFalse() As Boolean
Dim OutShow As Boolean = False
If csFunc.getUserHTTP = "myUname" Then
OutShow = True
Else
OutShow = False
End If
Return OutShow
End Function
I can't seem to call the two functions, tried different server tags etc. but none of the two functions is called. Both controls are displayed/visible on postback.
This is being used in a UserControl wchich has a parent page, this parent page also has a MasterPage.
Upvotes: 0
Views: 126
Reputation: 473
If you really want to call these two functions, use this on your code-behind
TESTLBLTEST.Visible = DisplayVisibleFalse()
And remove the runat="server"
from your div
<div id="div_HID_IntermediateInfos" style="display: <%= DisplayNone() %>">
But, as mentioned before, you should be using <asp:Panel>
instead.
Upvotes: 1
Reputation: 2490
Why dont you directly try
div_HID_IntermediateInfos.Visible = True
And
div_HID_IntermediateInfos.Visible = False
Upvotes: 0