473,416 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Collection of Profiles

Hey

asp.net 2.0

I want to populate a GridView with the profile properties off all users
registered on a website!

For example like this:
<profile enabled="true">
<properties>
<add name="FirstName" type="string"/>
<add name="LastName" type="string"/>
<add name="Gender" type="string"/>
<add name="BirthDate" type="DateTime"/>
</properties>
<profile>

Creating a GridView displaying the columns FirstName, LastName, Gender and
BirthDate...

My problem is that I don't know how to get the collection profiles.. The
only solution I can think of using a foreach loop on the MembershipUser
objects in MembershipUserCollection and create a ProfileCommon object for
each item in the MembershipCollection..:

List<ProfileCommonprofileList = null;
private MembershipUserCollection allUsers = Membership.GetAllUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProfile(user.UserName);
profileList.add(profile)
}
GridView1.DataSource = profileList;
GridView1.DataBind()

(I haven't tested the code above in visual studio 2005, so I'm not sure if
it compiles. I just wrote the code above to show what I whould do to get the
collection of profiles)

Isn't there a better way of doing this?

Jeff
Oct 26 '06 #1
3 6187
If you want to get all the profiles, you should be able to retrieve all the
proviles through the ProfileManager.GetAllProfiles() method, which will
return a ProfileInfoCollection. I haven't tried binding this to a grid, but
I believe this could work.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uU****************@TK2MSFTNGP04.phx.gbl...
Hey

asp.net 2.0

I want to populate a GridView with the profile properties off all users
registered on a website!

For example like this:
<profile enabled="true">
<properties>
<add name="FirstName" type="string"/>
<add name="LastName" type="string"/>
<add name="Gender" type="string"/>
<add name="BirthDate" type="DateTime"/>
</properties>
<profile>

Creating a GridView displaying the columns FirstName, LastName, Gender and
BirthDate...

My problem is that I don't know how to get the collection profiles.. The
only solution I can think of using a foreach loop on the MembershipUser
objects in MembershipUserCollection and create a ProfileCommon object for
each item in the MembershipCollection..:

List<ProfileCommonprofileList = null;
private MembershipUserCollection allUsers = Membership.GetAllUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProfile(user.UserName);
profileList.add(profile)
}
GridView1.DataSource = profileList;
GridView1.DataBind()

(I haven't tested the code above in visual studio 2005, so I'm not sure if
it compiles. I just wrote the code above to show what I whould do to get
the collection of profiles)

Isn't there a better way of doing this?

Jeff


Oct 26 '06 #2
Hey

I thought the same, but it doesn't quite work. Below is the code I tryed, it
crashes because "FirstName" isn't a property of ProfileInfo (it's one of the
properties specified in web.config in the profile section). I'm also
thinking that ProfileManager.GetAllProfiles returns a
ProfileMemberCollection, which contains a collection of ProfileInfo
objects.. I've been reading a bit here and see those custom properties is
available via the ProfileCommon class, but I don't know how to get a
collection of the ProfileCommon objects...

Any suggestions?

<asp:gridview ID="gvwUsers" runat="server" autogeneratecolumns="false" >
<Columns>
<asp:ButtonField HeaderText="UserName" DataTextField="UserName" />
<asp:ButtonField HeaderText="FirstName" DataTextField="FirstName" />
</Columns>
</asp:gridview>

protected void Page_Load(object sender, EventArgs e)
{
gvwUsers.DataSource =
ProfileManager.GetAllProfiles(ProfileAuthenticatio nOption.Authenticated);
gvwUsers.DataBind();
}

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:uX****************@TK2MSFTNGP03.phx.gbl...
If you want to get all the profiles, you should be able to retrieve all
the proviles through the ProfileManager.GetAllProfiles() method, which
will return a ProfileInfoCollection. I haven't tried binding this to a
grid, but I believe this could work.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uU****************@TK2MSFTNGP04.phx.gbl...
>Hey

asp.net 2.0

I want to populate a GridView with the profile properties off all users
registered on a website!

For example like this:
<profile enabled="true">
<properties>
<add name="FirstName" type="string"/>
<add name="LastName" type="string"/>
<add name="Gender" type="string"/>
<add name="BirthDate" type="DateTime"/>
</properties>
<profile>

Creating a GridView displaying the columns FirstName, LastName, Gender
and BirthDate...

My problem is that I don't know how to get the collection profiles.. The
only solution I can think of using a foreach loop on the MembershipUser
objects in MembershipUserCollection and create a ProfileCommon object for
each item in the MembershipCollection..:

List<ProfileCommonprofileList = null;
private MembershipUserCollection allUsers = Membership.GetAllUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProfile(user.UserName);
profileList.add(profile)
}
GridView1.DataSource = profileList;
GridView1.DataBind()

(I haven't tested the code above in visual studio 2005, so I'm not sure
if it compiles. I just wrote the code above to show what I whould do to
get the collection of profiles)

Isn't there a better way of doing this?

Jeff



Oct 26 '06 #3
Hey

I've found the solution in this link
http://www.theserverside.net/tt/arti...eProvider.html

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:Oo****************@TK2MSFTNGP05.phx.gbl...
Hey

I thought the same, but it doesn't quite work. Below is the code I tryed,
it crashes because "FirstName" isn't a property of ProfileInfo (it's one
of the properties specified in web.config in the profile section). I'm
also thinking that ProfileManager.GetAllProfiles returns a
ProfileMemberCollection, which contains a collection of ProfileInfo
objects.. I've been reading a bit here and see those custom properties is
available via the ProfileCommon class, but I don't know how to get a
collection of the ProfileCommon objects...

Any suggestions?

<asp:gridview ID="gvwUsers" runat="server" autogeneratecolumns="false" >
<Columns>
<asp:ButtonField HeaderText="UserName" DataTextField="UserName" />
<asp:ButtonField HeaderText="FirstName" DataTextField="FirstName" />
</Columns>
</asp:gridview>

protected void Page_Load(object sender, EventArgs e)
{
gvwUsers.DataSource =
ProfileManager.GetAllProfiles(ProfileAuthenticatio nOption.Authenticated);
gvwUsers.DataBind();
}

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:uX****************@TK2MSFTNGP03.phx.gbl...
>If you want to get all the profiles, you should be able to retrieve all
the proviles through the ProfileManager.GetAllProfiles() method, which
will return a ProfileInfoCollection. I haven't tried binding this to a
grid, but I believe this could work.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uU****************@TK2MSFTNGP04.phx.gbl...
>>Hey

asp.net 2.0

I want to populate a GridView with the profile properties off all users
registered on a website!

For example like this:
<profile enabled="true">
<properties>
<add name="FirstName" type="string"/>
<add name="LastName" type="string"/>
<add name="Gender" type="string"/>
<add name="BirthDate" type="DateTime"/>
</properties>
<profile>

Creating a GridView displaying the columns FirstName, LastName, Gender
and BirthDate...

My problem is that I don't know how to get the collection profiles.. The
only solution I can think of using a foreach loop on the MembershipUser
objects in MembershipUserCollection and create a ProfileCommon object
for each item in the MembershipCollection..:

List<ProfileCommonprofileList = null;
private MembershipUserCollection allUsers = Membership.GetAllUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProfile(user.UserName);
profileList.add(profile)
}
GridView1.DataSource = profileList;
GridView1.DataBind()

(I haven't tested the code above in visual studio 2005, so I'm not sure
if it compiles. I just wrote the code above to show what I whould do to
get the collection of profiles)

Isn't there a better way of doing this?

Jeff




Oct 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Test Test | last post by:
Hi, group! Here is some interesting problem: Our company has developed a large VB6 application that runs very smoothly on most environments. However, all of a sudden one of our customers...
0
by: Wayne Gibson | last post by:
Hi all, Please ignore the other post.. The cat jumped on the machine and sent it before I could stop it!! Was wondering if anybody has expericence this problem.. I am writting an application...
9
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
0
by: Selden McCabe | last post by:
I have a VB6 application running on a number of computers at a school. These all have Microsoft Office (and also Outlook) installed. They are using an Exchange server. This app uses the...
1
by: Anurag | last post by:
Hi, I have 2 related questions. DB2 UDB ESE v8.x (8.1 till 8.2 FP2 - all fixpaks included) on AIX 5.4.x _____________________________________________________________________________ (QUESTION 1)...
1
by: moondaddy | last post by:
I need to have multiple deployment profiles for a .net 2.0 winforms project. This is my requirement: 1) Re-use same project for multiple ClickOnce deployment profiles. 2) Each profile will...
0
by: dgk | last post by:
I've been trying to figure out how to set up a number of users and profiles for them. Having scanned many messages in this group, I came across one where Brock mentions using ProfileCommon. That...
1
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I really need help in this email. I am using pop3 service to connect to microsoft exchange. I have two profiles defined in microsoft exchange. One is west1 and another one is...
1
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I really need help in this email. I am using pop3 service to connect to microsoft exchange. I have two profiles defined in microsoft exchange. One is west1 and another one is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.