User.Identify.Name

G

Guest

I am not quites sure which happens first... the Form Load Event for the form or the form load event for the user control. I am wanting to obtain the User.Identify.Name in the UserControl, but I am not quite sure how to get a hold of the value. If I can only get it from the form which contains the control, how do I create a reference in the UserControl to the form which contains it? I tried to add a reference to the UserControl for the object which User object is derived from, but that did not seem to work

Any Ideas?
 
J

John Saunders

Jim Heavey said:
I am not quites sure which happens first... the Form Load Event for the
form or the form load event for the user control. I am wanting to obtain
the User.Identify.Name in the UserControl, but I am not quite sure how to
get a hold of the value. If I can only get it from the form which contains
the control, how do I create a reference in the UserControl to the form
which contains it? I tried to add a reference to the UserControl for the
object which User object is derived from, but that did not seem to work.

Details, please, Jim.

What exact problem are you having when you try to get User.Identity.Name
from within the user control?
 
S

Saravana [MVP]

You need to access like this inside usercontrol

Page.User.Identity.name

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



Jim Heavey said:
I am not quites sure which happens first... the Form Load Event for the
form or the form load event for the user control. I am wanting to obtain
the User.Identify.Name in the UserControl, but I am not quite sure how to
get a hold of the value. If I can only get it from the form which contains
the control, how do I create a reference in the UserControl to the form
which contains it? I tried to add a reference to the UserControl for the
object which User object is derived from, but that did not seem to work.
 
S

Saravana [MVP]

From usercontrol first you need to access the page object in which this
usercontrol is there then you can access other properties of page object.

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



Jim Heavey said:
Thanks... Not shure why in the UserControl I have to prefix with Page
object, but not in the page that calls it.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top