473,811 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.I sAuthenticated Then
authorize.pnlLo gin.Visible = False
authorize.pnlLo gout.Visible = True
Else
authorize.pnlLo gin.Visible = True
authorize.pnlLo gout.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 1801
"Mark" <py*******@hotm ail.com> wrote in message
news:%2******** *********@TK2MS FTNGP11.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.I sAuthenticated Then
authorize.pnlLo gin.Visible = False
authorize.pnlLo gout.Visible = True
Else
authorize.pnlLo gin.Visible = True
authorize.pnlLo gout.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
johnwsaundersii i at hotmail
Nov 18 '05 #2

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

Similar topics

0
1170
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: http://www.codeproject.com/cs/miscctrl/htmlwincontrol.asp Instead of loading the windows form user control I'm trying to load a windows form directly into the web control using the same method, meaning basically replacing in the code below OrderEntry.DLL with OrderEntry.exe Is this possible?...
3
2567
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 details, their locations, and then add themselves to categories. Each category requires additional info from the suppliers, this additional category info is stored in its own DB table. a suppliers may add themselves to as many categories as required....
1
1220
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 web form MyPage.aspx. Then I added code to declare the user control as instructed in the above article: ' Visual Basic menu as a user control Public Class MyPage Inherits System.Web.UI.Page Protected WithEvents Label1 As...
6
3384
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 the usual stuff of recreating the usercontrol in the Page Init event. The 'failure' sequence is as follows: - select web form button to display the user control - select user control button, event fires - select web form button to display...
9
2475
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 post event will always execuate after the system is completed... - I want to wrap this functionality in a framework, so I could possibly have 3 or 4 levels of inherited objects that need to have these pre / post events executed before and after the...
1
3404
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, I'm getting the following error: Cannot create an object of type 'System.EventHandler' from its string representation 'OnSubmit' for the 'OnSubmit' property.
5
2170
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) txtAddress.Text = value End Set
2
1196
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 character input. win must be a valid Glk window.
2
2210
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 methods to expose the properties, I would rather just expose the user control as a property of the MasterPage. The problem is, when I compile, I get an exception on the content page: The type 'MessageBlock.MessageBlock' is defined in an...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10652
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.