Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 1st, 2010, 04:02 AM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to retreive user through its profile properties?

Hi,

I want to customize the user search on Admin's ManageUser.aspx.

And add the First Name and Last Name along with Email and Username to the drop down list.

Have anyone done this before?

Can anyone tell me how can I modify the membership module to achieve this functionality?

Regards,
dazy
  #2 (permalink)  
Old February 1st, 2010, 11:34 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

What you are essentially trying to do is to query based on profile properties. Unfortunately, using the default SqlProfileProvider, this is not possible. This is because the profile data is serialized as a blob in the table, rather than in seperate columns, so you can't target specific properties in a query.

If you really need to do this, you need to use a custom profile provider that maps profile properties to a strictured database table. ScottGu has a blog post that explains how to do this here.

http://weblogs.asp.net/scottgu/archi...10/435038.aspx
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #3 (permalink)  
Old February 1st, 2010, 12:37 PM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

But I think I can do it by modifing the filteredUsers() function of ManageUser.aspx page.

Code:
MembershipUserCollection AllUsers = new MembershipUserCollection();
    MembershipUserCollection AllAdmins = new MembershipUserCollection();

private void GetUsersByName(String FN, String LN)
    {
       

        string[] AllAdmins = Roles.GetUsersInRole("Admin");

        
        if (FN != null)
        {
            
            foreach (MembershipUser User in AllUsers)
            {
                foreach (string Admin in AllAdmins)
                {
                    ProfileCommon profile = new ProfileCommon();
                    profile = profile.GetProfile(User.UserName);
                    if (FN == profile.FirstName)
                    
                    {
                        requiredUsers.Add(User);
                        
                    }
                }
                
            }
        
        }

       
        if (LN != null)
        {
           
            foreach (MembershipUser User in AllUsers)
            {
                foreach (string Admin in AllAdmins)
                {
                    ProfileCommon profile = new ProfileCommon();
                    profile = profile.GetProfile(User.UserName);
                    if (LN == profile.LastName)
                    {
                        requiredUsers.Add(User);
                        
                        
                    }
                }
            }
        
        
        }    
    
    }
But I guess there is some issue with the loops placement because in some conditions this code works and in others not.

What is your opinion about this solution?

Regards,
dazy.
  #4 (permalink)  
Old February 1st, 2010, 12:51 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

What are you trying to do by adding an AllAdmins collection here?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #5 (permalink)  
Old February 1st, 2010, 01:09 PM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm trying to retrieve all the admins on the ManageUsers.aspx page, so that I can edit or delete their accounts.

Regards,
dazy
  #6 (permalink)  
Old February 1st, 2010, 01:19 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Okay, then why do you need to search by first name or last name then?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #7 (permalink)  
Old February 1st, 2010, 01:33 PM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Search by First and Last Name is the requirement of my project. It is like super admin can search the admins by their First Name, Last Name.

Regards,
dazy
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
user profile trouble Maxxim BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 7 October 9th, 2007 07:24 PM
Profile properties depending on the member type mecca BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 24th, 2007 05:43 PM
want to retreive current user name in windows al_samirr Access VBA 2 November 29th, 2006 01:46 AM
How can I retreive user role from sql server 2005? MAKO C# 0 July 7th, 2006 09:13 AM
User Profile edgelogix Pro PHP 1 December 3rd, 2005 04:17 PM



All times are GMT -4. The time now is 02:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.