+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Profile Properties

Profile Properties

5 posts, 0 answered
  1. Muhammad Saqib
    Muhammad Saqib avatar
    95 posts
    Registered:
    09 Sep 2009
    12 Nov 2010
    Link to this post
    I am trying to add collection object in Profile Property.
    I found this article
    http://msdn.microsoft.com/en-us/library/d8b58y5d.aspx
    and tried to implemet "Working with User-Defined Property Types" , and even "Working with Complex Property Types" like string collection.

    I added in web.config
    <add name="MyValues"
          type="System.Collections.Specialized.StringCollection"
          serializeAs="Xml" />

    and in code behind
    if (Profile.MyValues== null)
                    Profile.MyValues= new System.Collections.Specialized.StringCollection();
     
    Profile.MyValues.Add("my value");

    But when i try to retrieve it thorws exception

    Unable to cast object of type 'System.String' to type 'System.Collections.Specialized.StringCollection'.


    any help will be appreciated :-) :-(



  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Nov 2010
    Link to this post
    Hello Muhammad,

    Please take a look at the code below

    SettingsContext sc = new SettingsContext();
    SettingsPropertyValueCollection properties = this.Profile.GetPropertyValues(sc, ProfileBase.Properties);
    foreach (SettingsPropertyValue property in properties)
        {
     
           if (value != null)
               {
                    property.PropertyValue = value;
               }
        }
    this.Profile.SetPropertyValues(sc, properties);


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Muhammad Saqib
    Muhammad Saqib avatar
    95 posts
    Registered:
    09 Sep 2009
    12 Nov 2010
    Link to this post
    where to write this code :-)

    There is no method GetPropertyValues, its GetPropertyValue Only ...
  4. Muhammad Saqib
    Muhammad Saqib avatar
    95 posts
    Registered:
    09 Sep 2009
    13 Nov 2010
    Link to this post
    any help??
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Nov 2010
    Link to this post
    Hi Muhammad,

    I checked the case once again and it turned out that this is a bug in the Provider. The issue has been fixed. If you want I could send you an internal build and you should upgrade your project to benefit from the fix. You may open a support request and just paste the link to the thread and I will attach the internal patch.
    There is no workaround to this issue.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
5 posts, 0 answered