Solved

How to access ASP.Net user information from a colelction

Posted on 2007-12-03
5
498 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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