Solved

How to access ASP.Net user information from a colelction

Posted on 2007-12-03
5
497 Views
Last Modified: 2008-02-01
Greetings

I have a list box that needs to display a list of users (all, not just logged on). In  the panel on the right hand side I want to display the data (eg email address) related to the current user.

MembershipUserCollection allTheUsers;

     if (!IsPostBack)
        {
             allTheUsers= Membership.GetAllUsers();
            this.UsersListBox.DataSource = allTheUsers;
            this.UsersListBox.DataBind();
        }

My questions:

(1)  Is this the correct way to do it?
(2)  Having bound the collection to the listbox, how do I display only the username?
(3)  How do I get the value of (for example) the EMail field of the currently selected user?
(4)  If I add/delete a user, do I do another GetAllUsers()?  Is this acceptable? Is there a better way?

In advance, thanks!
0
Comment
Question by:allanmark
  • 3
5 Comments
 

Accepted Solution

by:
replylalit earned 425 total points
ID: 20394750
http://www.informit.com/articles/article.aspx?p=351414&rl=1

This can help maybe?
You can easily retrieve the email username or anything from the listbox or from the collection. Refer to the article.
0
 
LVL 7

Expert Comment

by:nisarkhan
ID: 20394898
one question at a time and you have 4 questions :)
0
 

Author Comment

by:allanmark
ID: 20394927
Ok.

What is the proper way to do this. Should I post 4 individual questions?
0
 

Author Comment

by:allanmark
ID: 20395077
Figured out (I think) question 3:-

muTheUser = mucAllTheUsers[lbxUsers.SelectedItem.Value];
 txtUser.Text     = muTheUser.UserName;
0
 

Author Comment

by:allanmark
ID: 20395196
Ooops!!  Over eager - my effort isn't correct!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now