Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Todd Coleman 7 posts 71 karma points
    May 05, 2010 @ 15:59
    Todd Coleman
    0

    Refresh CMS Panel

    I created a Site Template and made a related copy of it called Child Site in the CMS.  I created a SynchronizationButton Data Type to synchronize default text from the Site Template to the related Child Site.  When I click the button, it finds the related parent text control, gets the content and saves it to the child text control.  The issue is that the click event of the synchronization button happens after the child control is instantiated with it's previous text content (not the copied content from the parent).  Is there any way to refresh the CMS Panel after I save the document so that the child text content appears to the user as the text content from the parent?

    See code below:

    protected void btnSynchronize_Click(object sender, EventArgs e)
    {
        RelationType relationType = RelationType.GetByAlias("relateDocumentOnCopy");
        Relation[] relations = Relation.GetRelations(nodeId, relationType);
        lblOutput.Text = "NodeId: " + nodeId.ToString() + "<br/>";
        foreach (Relation relation in relations)
        {
            lblOutput.Text += "Parent ID: " + relation.Parent.Id + "<br/>";
            int parentId = relation.Parent.Id;
    
            Document parentDoc = new Document(parentId);
            umbraco.cms.businesslogic.property.Property parentProperty = parentDoc.getProperty("description_content");
    
            Document currentDoc = new Document(nodeId);
            umbraco.cms.businesslogic.property.Property thisProperty = currentDoc.getProperty("description_content");
    
            lblOutput.Text += "ParentProperty: " + parentProperty.Value + "<br/>";
    
            thisProperty.Value = parentProperty.Value;
    
            currentDoc.Save();
    
            //CMSPanel.Refresh();  <--what goes here?
        }
    }
  • Todd Coleman 7 posts 71 karma points
    May 05, 2010 @ 18:14
    Todd Coleman
    0

    Ok, I think I figured out a way.  Comment please if there is a better.

    Instead of trying to figure out how to refresh the panel, I just did a recursive Control search and found the textbox and updated the Text field.

                   TextBox c = FindControlRecursive(this.Page, "description_content") as TextBox;
                    c.Text = parentProperty.Value.ToString();
Please Sign in or register to post replies

Write your reply to:

Draft