Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How can I know my content Id? I have a decimal field in my content page and I want to know the Id. How can I figure that out. Thanks.
Please can you clarify what you are struggling with here?
You say you want to know what your content id is.
In what context? Do you need to know it on the front end?
If so that should be as simple as Model.Id or Model.Content.Id
If you want to know it in Umbraco, you can see it at the end of the url.
You have mentioned a decimal field, are you trying to populate that with the id of your content item? It is a bit pointless to do this as you already have the id as mentioned above. You could do it with the SendingContentModel event like this:
public class MyEventHandler : ApplicationEventHandler
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
EditorModelEventManager.SendingContentModel += EditorModelEventManager_SendingContentModel;
private void EditorModelEventManager_SendingContentModel(System.Web.Http.Filters.HttpActionExecutedContext sender, EditorModelEventArgs<Umbraco.Web.Models.ContentEditing.ContentItemDisplay> e)
if (e.Model.ContentTypeAlias == "myDocTypeAlias")
var nodeId = e.Model.Properties.FirstOrDefault(f => f.Alias == "myPropertyAlias");
if (nodeId.Value == null || String.IsNullOrEmpty(nodeId.Value.ToString()))
nodeId = e.Model.Id;
Link for reference. https://our.umbraco.com/Documentation/Reference/Events/EditorModel-Events/index-v7
I hope that helps
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted