Copied to clipboard

Flag this post as spam?

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


  • Kristoffer Eriksen 185 posts 465 karma points
    Mar 07, 2011 @ 15:51
    Kristoffer Eriksen
    0

    Get Specific tab

    Hey Fellow developers

    I've searched and searched, but can't find any solution, to get a specific tab on a Item.

    The reason I want to do this, is to get every single field in this tab, and render every field to the page. If this is possible, then all I need to do, if I want to add some more information to the tah, is to add it to the documenttype, end than it is available, and gets rendered.

    Any solution ?

    Best Regards

    Kristoffer

  • kows 81 posts 151 karma points c-trib
    Mar 07, 2011 @ 16:02
  • Kristoffer Eriksen 185 posts 465 karma points
    Mar 08, 2011 @ 08:16
    Kristoffer Eriksen
    0

    Hey kows

    Great link.

    But is there a way to not only get the propertyType.Name on the documenttype, but also the propertyvalue on the current node, based on that documenttype, in a specific tab  ?

    Best Regards

    Kristoffer

  • kows 81 posts 151 karma points c-trib
    Mar 08, 2011 @ 16:02
    kows
    0

    use the alias from each propertytype and get the value combined with Node.GetCurrent() ?

  • Kristoffer Eriksen 185 posts 465 karma points
    Mar 08, 2011 @ 21:56
    Kristoffer Eriksen
    0

    Hey Kows

    I'm fairly new to Umbraco, but it makes sense what you suggest.

    Something like

    Node current = Node.GetCurrent();
    DocumentType dt = DocumentType.GetByAlias(current.NodeTypeAlias);
    if(dt != null) {
    foreach (var tab in dt.getVirtualTabs) {
     // The tab I'm searchin for has ID 17
     if (tab.Id == 17)
     {
      foreach (var propertyType in tab.PropertyTypes)
      {
       new LiteralControl
       {
       Text = string.Format("{0}-{1}", propertyType.Name, current.GetProperty(propertyType.Alias))};
       }
      }
     }
    }

    Haven't tried it yet, since I won't have acces to the solution until tomorrow...

  • Kristoffer Eriksen 185 posts 465 karma points
    Mar 09, 2011 @ 08:28
    Kristoffer Eriksen
    0

    Just to do a follow up. The above works perfect.

    Thank you for pointing me in the right direction

  • 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