Solved

How to access ASP.Net user information from a colelction

Posted on 2007-12-03
5
501 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

734 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