SaaS CMS has officially launched! Learn more now.

Store multiple values in an attribute?


Is it possible to store multiple values in an attribute?

In my case I have a ListBox with SelectionMode=Multiple, where I want to be able to save and retrieve all selections easily. Is it possible to do something like below?

public List<int> Ids
    get { return GetAttributeValue<List<int>>("Ids"); }

    set { SetAttributeValue<List<int>>("Ids", value); }

Thank you in advance!

Jun 19, 2008 11:31

Never mind, I missed out that a GetAttributeValues method existed Laughing

Solution below seems to work fine.

public IList<int> Ids
get { return (IList<int>)GetAttributeValues<int>("Ids"); }
set { SetAttributeValue<int>("Ids", value); }
Edited, Jun 19, 2008 13:50


Yes this is possible by calling SetAttributeValues like this:

List<int> list = new List<int>();
SetAttributeValues("IDs", list);

You can also do the same with complex values:

List<Blog> list = new List<Blog>();
SetAttributeValues("Blogs", list);


Edited, Jun 19, 2008 13:50
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.