Copied to clipboard

Flag this post as spam?

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


  • Shaun 248 posts 475 karma points
    Dec 03, 2009 @ 15:14
    Shaun
    0

    assigning values to node properties dynamically.

    I have a .Net user control that creates nodes dynamically and pops them under a selected parent node. The code is below.

    I want to assign values to the three properties of my created node, but can't seem to hit on the right syntax. Can anyone help? I'm writing in C#

    //create node           
    string strDocumentName = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_ffffff");          

    DocumentType dt = DocumentType.GetByAlias("Comment");
               
    //author uses a dummy user called CommentWriter
    User author = User.GetUser(2);          

    Document doc = Document.MakeNew(strDocumentName, dt, author, _intParentId);

    //add properties??

    doc.Publish(author);
    umbraco.library.UpdateDocumentCache(doc.Id);
  • Tim 225 posts 690 karma points
    Dec 03, 2009 @ 15:43
    Tim
    0

    Hi,

    This should work:

    doc.getProperty("property_alias_in_here").Value = "Your value";

    T

  • Shaun 248 posts 475 karma points
    Dec 03, 2009 @ 16:16
    Shaun
    0

    Thanks Tim!

  • Tim 225 posts 690 karma points
    Dec 03, 2009 @ 19:35
    Tim
    0

    Glad I could hep!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies