Alternatively you could put a panel inside the user control, but around it's content and then set the visibility of that panel within the controls codebehind depending on whether the username and password are valid or not. That way the hiding/showing of the control is completely handled by itself and requires no extra code outside of the control.
Main Topics
Browse All Topics





by: PsyberionPosted on 2009-11-05 at 17:24:38ID: 25755959
Do you have the relevant section of the html source? is this vb, c#, c++?
---------
You could wrap the user control in an asp:panel and change the .visible property of the panel in the codebehind.
HTML:
--------
<asp:panel id="panel1" runat="server">
<my:UserControl ... runat="server"/>
</asp:panel>
Page.aspx.vb (for example)
--------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (IsPostBack) Then
If (<check if user has authenticated ok from username and password in user control>) Then
panel1.Visible = False
End If
End If
End Sub