473,320 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Exposing event in user control

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?
Nov 18 '05 #1
1 1783
"Mark" <py*******@hotmail.com> wrote in message
news:%2*****************@TK2MSFTNGP11.phx.gbl...
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.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Not Available | last post by:
I have windows form user control which I load into the browser via this ascx web user control and it works. The process is explained at this link:...
3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
1
by: Jason | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbwlkwalkthroughcreatingwebusercontrols.asp Following the above example I created a usercontrol and added it to another...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
9
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
1
by: Paul | last post by:
Hi all, I have a custom server control that can contain one or more buttons. I'm trying to expose an event handler as a property so that the buttons can fire a click event when clicked. However,...
5
by: rn5a | last post by:
Consider the following user control which resides in Address.ascx: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)...
2
by: Neil Cerutti | last post by:
I'm using doctest for the first time, and boy is it cool. But I'm nervous about exposing library internals in the docstring. def glk_cancel_char_event(win): """ Cancel a pending request for...
2
by: =?Utf-8?B?RGFsZQ==?= | last post by:
I have an app with a MasterPage. In the MasterPage is a user control with several public properties and methods that I want exposed to the content page. Rather than writing several redirection...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.