473,657 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 MembershipUserC ollection and create a ProfileCommon object for
each item in the MembershipColle ction..:

List<ProfileCom monprofileList = null;
private MembershipUserC ollection allUsers = Membership.GetA llUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProf ile(user.UserNa me);
profileList.add (profile)
}
GridView1.DataS ource = profileList;
GridView1.DataB ind()

(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 6200
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 ProfileInfoColl ection. 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.NO SPAMwrote in message
news:uU******** ********@TK2MSF TNGP04.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 MembershipUserC ollection and create a ProfileCommon object for
each item in the MembershipColle ction..:

List<ProfileCom monprofileList = null;
private MembershipUserC ollection allUsers = Membership.GetA llUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProf ile(user.UserNa me);
profileList.add (profile)
}
GridView1.DataS ource = profileList;
GridView1.DataB ind()

(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
ProfileMemberCo llection, 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" autogeneratecol umns="false" >
<Columns>
<asp:ButtonFiel d HeaderText="Use rName" DataTextField=" UserName" />
<asp:ButtonFiel d HeaderText="Fir stName" DataTextField=" FirstName" />
</Columns>
</asp:gridview>

protected void Page_Load(objec t sender, EventArgs e)
{
gvwUsers.DataSo urce =
ProfileManager. GetAllProfiles( ProfileAuthenti cationOption.Au thenticated);
gvwUsers.DataBi nd();
}

"Mark Fitzpatrick" <ma******@fitzm e.comwrote in message
news:uX******** ********@TK2MSF TNGP03.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 ProfileInfoColl ection. 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.NO SPAMwrote in message
news:uU******** ********@TK2MSF TNGP04.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 MembershipUserC ollection and create a ProfileCommon object for
each item in the MembershipColle ction..:

List<ProfileCo mmonprofileList = null;
private MembershipUserC ollection allUsers = Membership.GetA llUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProf ile(user.UserNa me);
profileList.add (profile)
}
GridView1.Data Source = profileList;
GridView1.Data Bind()

(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.NO SPAMwrote in message
news:Oo******** ********@TK2MSF TNGP05.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
ProfileMemberCo llection, 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" autogeneratecol umns="false" >
<Columns>
<asp:ButtonFiel d HeaderText="Use rName" DataTextField=" UserName" />
<asp:ButtonFiel d HeaderText="Fir stName" DataTextField=" FirstName" />
</Columns>
</asp:gridview>

protected void Page_Load(objec t sender, EventArgs e)
{
gvwUsers.DataSo urce =
ProfileManager. GetAllProfiles( ProfileAuthenti cationOption.Au thenticated);
gvwUsers.DataBi nd();
}

"Mark Fitzpatrick" <ma******@fitzm e.comwrote in message
news:uX******** ********@TK2MSF TNGP03.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 ProfileInfoColl ection. 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.NO SPAMwrote in message
news:uU******* *********@TK2MS FTNGP04.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 MembershipUserC ollection and create a ProfileCommon object
for each item in the MembershipColle ction..:

List<ProfileC ommonprofileLis t = null;
private MembershipUserC ollection allUsers = Membership.GetA llUsers();
foreach (MembershipUser user in allUsers) {
ProfileCommon profile = Profile.GetProf ile(user.UserNa me);
profileList.add (profile)
}
GridView1.Dat aSource = profileList;
GridView1.Dat aBind()

(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
3884
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 (unsing WinNT SP6) experienced a dramatic performance drop. We investigated, and it turned out that it depends on the
0
1806
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 in C# using windows forms, to create windows user profiles and then updating the registry information for the new profiles. I have managed to create the user successfully and thought that I was
9
6726
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
0
971
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 msmapi32.ocx to send mail. On MOST of the computers, this works. But on a few of these computers, where it was working for a long time, it now gives an invalid session ID.
1
4932
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) Output of "db2ilist" does not list all the instances on my AIX box. DB2 functions normally - I do not get any unexpected errors. Any ideas what configuration has been missed out?...
1
2775
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 have it's own custom deployment properties such as Publish Version Number, Start Menu and application Name in start menu. For example, in the past (before ClickOnce deployment) I had to build Setup.exe files and distribute them to various...
0
1150
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 actually does seem to work, and I can access and change values for the fields created in Web.Config. I'm using the default provider. Is this the accepted way of handling profiles for users other than the logged in user?
1
1343
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 west2. When I am trying to connect to west1. I can succesfully connect to the excahnge mail box, but if i try to connect to another west2 profile then
1
1330
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 west2. When I am trying to connect to west1. I can succesfully connect to the excahnge mail box, but if i try to connect to another west2 profile then
0
8833
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8610
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.