Dynamic linkcollection

Vote:
 

I'm trying to create a dynamic content linkcollection. Have anyone tried this before? Or created a dynamic content with another kind of specializedproperty? It would be great to have a more advanced example than the dynamic content examples I find :)

My issue at the moment is the following: I open the dynamic content window and choose my dynamic linkcollection. Under settings, an empty linkcollection shows up. I click "add link" and the add-link window opens. I choose a link and the window closes. Now the dynamic content window reloads and the linkcollection disappears... No linkcollection with the added link and no new empty linkcollection either, the settings-area is empty.

This is my editcontrol:

public partial class DynamicLinkCollectionsSettings : DynamicContentEditControl
    {
        public PropertyLinkCollection linkCollection { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                linkCollection.Links = ((DynamicLinkCollections)Content).LinkCollection.Links;
            }
            else
            {
                linkCollection = new PropertyLinkCollection();
                linkCollection.Links = new LinkItemCollection();
            }

            LinkCollectionProperty.InnerProperty = linkCollection;
            LinkCollectionProperty.EditMode = true;
        }

        public override void PrepareForSave()
        {
            if(linkCollection.Links!=null && linkCollection.Links.Count>0)
                ((DynamicLinkCollections) Content).LinkCollection.Links = linkCollection.Links;
        }
    }

#25799
Nov 06, 2008 10:52
Vote:
 

Haven't tested this myself, but earlier posts on using regular properties in "fake" EditMode points out that you need some more magic to have the property read in its values on postbacks.

See http://world.episerver.com/Forum/Pages/thread.aspx?id=19701 for an example.

/Steve

#25831
Nov 06, 2008 21:00
Vote:
 

Hi

 If you take a look at

http://labs.episerver.com/en/Blogs/Anders-Hattestad/Dates/2008/10/Properties-in-CMS-5/

That is a dynamic list of properties. All properties I have tryied inside this construction have worked in dynamic content setting.

 

#25835
Edited, Nov 06, 2008 22:36
Vote:
 

I'm awaiting access to your project, Anders. In the meantime I had a look at the thread you gave, Steve. I can see that it is related to my problem, but I can't seem to find a way to translate it completely as the context is a bit different. I think that thread was solving the problem of updating a property on a page after editing the property in some custom editmode. I'm not trying to update a property on the currentpage, I'm trying to update a property (which will still be in editmode) in my dynamic content window. And then afterwards I'll be dealing with the problem of actually getting it into the page :D

The PropertyLinkCollections edit/add-link-window triggers a postback on my dynamic content window, and in that process my dynamic content window looses it's linkcollection property. I think I need to maintain the connection between the dynamic content window and the linkcollection, despite the postback, but I have no idea how Frown

#25836
Edited, Nov 07, 2008 9:49
Vote:
 
I used Anders' MultiProperty instead, that worked out great!
#25859
Nov 10, 2008 8:29
Vote:
 
That is great news
#25864
Nov 10, 2008 14:25
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.