Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8623851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:22:57+00:00 2026-06-12T07:22:57+00:00

Umbraco newbie of course.. I have some code that returns a certain data type

  • 0

Umbraco newbie of course..

I have some code that returns a certain data type contents for a given node id which is detailed here:

umbraco API: trying to get the document type data for a given site node

That works fine, however I have to know the starting node i.e. in my case the site node id (multi-site umbraco installation).

I also know you can get the master root node via:

Umbraco – Finding Root Node in C#

My question is this…

From the backend API, is there anyway to dynamically get the current site node ID (first link)? this is so I don’t have to know it in advance. I think there is an option to get the site id from a querystring.. Page.Request.QueryString[“id”] however I am guessing this is returned if the page is a template page, however this is from a backend class?

Is there anyway? or I am barking up the wrong tree! ??

Any help would be appreciated!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:22:58+00:00Added an answer on June 12, 2026 at 7:22 am

    Assuming that all of your rootnodes are of the same document type, in razor you could do something like this:

    var folderId = @Model.AncestorOrSelf(“MyFolderType”).Id;

    which will search from the current node ‘up’ or ‘backwards’ until it gets to a nodetype of the type specified.

    another way is available here:

    http://our.umbraco.org/forum/developers/api-questions/20742-Getting-the-home-node-using-c

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an umbraco project with a masterpage (with it's own content type) and
I have an umbraco macro that spits out the content of the page at
I have an Umbraco website that is running on IIS7.5 and is Load Balanced.
I'm new to Umbraco. I am using Umbraco 5 RC2. I have noticed that
I have an Umbraco tree node id in javascript. How can I get the
Hello how to check in Umbraco that node that i get by Id is
So I have an umbraco setup with a 'content' root node and then a
I'm working with Umbraco 4.7.1 and I've created some extensions that hook into Document.AfterPublish
So I have an umbraco site with a number of products in it that
Using Umbraco, which is quicker to load on a page... XSLT Macro or a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.