Showing posts with label CSHTML. Show all posts
Working with Dynamic Pagination in ASP.NET
Pagination is a typical process in data display whereby large sets of data are broken into discrete sections for viewing, more often than not used in conjunction with some type of grid or list component.
CSHTML:
@using Smp.Web.Common;
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
.
How to get the Created & last Published date of a Node in Umbraco?
Using the following CSHTML code we can easily get the Created & last Published date of a Node in Umbraco.
To get the Created Date of an Umbraco Node:
@Model.CreateDate
To get the Last Published Date of an Umbraco Node:
@Model.UpdateDa.
How to check whether an Umbraco Node has children or not?
The following Razor code is used to check whether an Umbraco Node has children or not.
bool hasChildren = (Model.ChildrenAsList.Count() > 0);
if(hasChildren)
{
//code
}
else
{
//code
}.
Razor function to fetch the Data Type Items in Umbraco
The following Razor function is used to fetch the Data Type Items in Umbraco.
Namespaces Required:
using System.Xml.XPath;using umbraco.MacroEngines;
@functions{
public List<string> FetchDataTypeItems(int DataTypeNodeID)
.
How to find the Document Type Alias of the First Child Node using Razor?
To find the Document Type Alias of the First Child Node using Razor.
@Model.Children.First().NodeTypeAlias.