I have posted a couple of times on this issue and I haven't received any replies to point me in the right direction. I don't know if my question is so remedial that nobody wants to waste their time answering it or if it is so difficult nobody has been able to do it or if I have approached it in a way that is so off-base that nobody understands my questions. Please toss me a clue.
I have a subset of users I want to display. Just about every social networking website I have visited has this feature. I can't believe that it is so hard to do in Community Server. Say you have a weight loss site and you want to allow users to find everyone on the same diet. You want to display their picture, their bio, how much weight they have lost, etc. Maybe you have a teen site and you want members to be able to find others who like to skateboard and live within 20 miles of them. You want to display their picture, their bio, what type of board the ride, how many bones they have broken, etc. Maybe you have a recipe site and you want members to be able to find others with a cupcake recipe using whey. You want to display their avatar, their recipe, etc.
I have the list of users. How do I display them? Ideally, I would like to display some information from custom tables along with the avatar.
I've spent a good part of the last two or three days working on this. I'm getting very frustrated. Do I need to write my own controls to do this? Has anyone done this? Would anybody be willing to share a code example of how this has been done? I've tried everything I can think of using Community Server controls and nothing has worked.
Thank you!
Essentially, you'll need to build up a custom List<User> object and set that as the datasource of a CSControl:UserList control.
As for displaying custom data about the user in that same control, how is that additional data stored. Is it stored in the user's Extended Attributes, or is it stored in a custom table.
CS Documentation | Nintendo Wiikly
I received an error that the datasource for the userlist control needed to be a List<User> object. What exactly is a List<User> object? How would I go about creating a custom version of that?
The custom data is stored in a series of custom tables. We have a very complicated data model. Extended attributes are not going to work for this site. I am trying to simplify my question to get a simple answer. If I can get a small example working, I can get the whole thing working.
I am a seasoned developer, but new to ASP. Please point me in the right direction and give me a kick start. Hopefully I won't bother you again until I hit my next roadblock.
The List (located in the System.Collections.Generic namespace) is a Generic - see http://msdn.microsoft.com/en-us/library/0x6a29h6.aspx for more reading on what generics are in C#. Simply, it is a class of another type - in this case a List of the "User" type. For more documentation on the List clas,s have a look at http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx.
For example, the folowing code should should display two users in the UserList - admin and testuser
List<Users> users = new List<Users>(); users.Add(Users.GetUser("admin");users.Add(Users.GetUser("testuser");UserList1.DataSource = users;UserList1.DataBind();
List<Users> users = new List<Users>();
users.Add(Users.GetUser("admin");users.Add(Users.GetUser("testuser");UserList1.DataSource = users;UserList1.DataBind();
could you not assign them a role and give them a badge? on the forums if you see soemone with a badge and click on it it searches for all members of that role. might worth looking at?
Footprint Friends Supporters
Afscrome,
Thank you, that got me going in the right direction. I think I will be able to display my custom information in a repeater and have a nested UserList control within that repeater. I will set the datasource of the UserList in the itemdatabound event of the outer repeater using your code snippet to limit it to the user being displayed on that row.
Rick
Slee,
Thanks for the idea. I hadn't looked into Roles and I had never heard of badges before.
However, I don't think that will work for my current needs. Each user would have to be assigned to their own role, since each search would result in different sets of users that I would want to display. Then I would have to display a set of roles.
I think I will be able to use afscrome's code snippet to achieve what I need.
In that case I'd suggest you just use a UserData control instead of a UserList control as UserList takes a User object as it's datasource, and is designed for showing data of a single user as opposed to a list of users. If you need to show multiple properties from a UserList, you can always set hte datasource on one USerDatacontrol, and nest further UserData controls within that control
<%-- Set the Datasource on only this control --%><CSControl:UserData runat="server" ID="USERDATAID"> <ItemTemplate><CSControl:UserData Property="DisplayName" runat="server"><CSControl:UserAvatar runat="server" /> </ItemTemplate></CSControl:UserData>
<%-- Set the Datasource on only this control --%><CSControl:UserData runat="server" ID="USERDATAID"> <ItemTemplate><CSControl:UserData Property="DisplayName" runat="server"><CSControl:UserAvatar runat="server" />
</ItemTemplate></CSControl:UserData>
Awesome! I didn't know you could nest UserData controls, that's why I was looking at the UserList.
This works great. My website is beginning to look more and more like a website.
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com