Exposing event in user control


M

Mark

I have an aspx page that contains a usercontrol. The usercontrol is titled
'authorize'. 'authorize' contains 2 panel 'login' and 'logout'. Both are by
default 'not visible'
I want to set one of them, dependingn on whether the user IsAutheticated
(forms), to visible.

Whe I put the following code in my aspx page:
Sub Page_Load
If User.Identity.IsAuthenticated Then
authorize.pnlLogin.Visible = False
authorize.pnlLogout.Visible = True
Else
authorize.pnlLogin.Visible = True
authorize.pnlLogout.Visible = False
End If
End Sub

I get an error about being 'private'.

If I place the same code in my usercontrol, the error is 'user' is not
declared. (without the 'authorize' before the pnlLogin/Logout of course)

How can I accomplish this?
 
Ad

Advertisements

J

John Saunders

Mark said:
I have an aspx page that contains a usercontrol. The usercontrol is titled
'authorize'. 'authorize' contains 2 panel 'login' and 'logout'. Both are by
default 'not visible'
I want to set one of them, dependingn on whether the user IsAutheticated
(forms), to visible.

Whe I put the following code in my aspx page:
Sub Page_Load
If User.Identity.IsAuthenticated Then
authorize.pnlLogin.Visible = False
authorize.pnlLogout.Visible = True
Else
authorize.pnlLogin.Visible = True
authorize.pnlLogout.Visible = False
End If
End Sub

I get an error about being 'private'.

If I place the same code in my usercontrol, the error is 'user' is not
declared. (without the 'authorize' before the pnlLogin/Logout of course)

How can I accomplish this?

Use Page.User inside of the user control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top