Search code examples
asp.netuser-controlsumbraco

How do i get the tab name in a usercontrol umbraco


Does anyone know how to get the tabname of a contentpage? I know how to get the id but not how to get the name? This is my code so far:

 int userId = umbraco.BasePages.UmbracoEnsuredPage.GetUserId(umbraco.BasePages.UmbracoEnsuredPage.umbracoUserContextID);  
           DocumentType typeToCreate = DocumentType.GetByAlias("FAQItem");

                Document newDoc = Document.MakeNew("test123", typeToCreate, new global::umbraco.BusinessLogic.User(userId), 1161);
                newDoc.getProperty("yourName").Value = newDoc.getProperty("Question");

                    foreach(var prop in newDoc.GenericProperties)
                    {
                        newDoc.getProperty("email").Value += prop.PropertyType.TabId + " ";
                    }

Solution

  • I managed the same using .getVirtualTabs, something like:

    foreach (var t in dt.getVirtualTabs())
     {
      if (t.Id == id)
      return t.Caption;
     }