Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to access ASP.Net user information from a colelction

Posted on 2007-12-03
5
Medium Priority
?
505 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 1275 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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 …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Loops Section Overview
Suggested Courses

971 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