Saturday, June 5, 2010

Getting user profile values that support multiple value

if (Profile[this.UserProfilePropertyName].Count == 1)
    return Profile[this.UserProfilePropertyName].Value.ToString();
else
{
    StringBuilder ret = new StringBuilder("");
    UserProfileValueCollection values = Profile[this.UserProfilePropertyName];
    System.Collections.IEnumerator allValues = values.GetEnumerator();
    while(allValues.MoveNext())
    {
        ret.Append(allValues.Current.ToString());
        ret.Append(";");
    }
    return ret.ToString();
}

No comments:

Post a Comment