Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Get Block data on view



I'm using EPiServer 7.5 MVC. I have a view for my page with a content area. I need to get the datas of block(which comes inside content area) on my page(view). Is it possible?

Mar 12, 2014 11:52

Try this:

    var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
    if (page != null && page.ContentArea != null && page.ContentArea.Items.Any())
        foreach (var contentItem in page.ContentArea.Items)
            var item = contentLoader.Get<YOUR_CONTENT_TYPE>(contentItem.ContentLink);          
            // output necessary properties from content instance


Mar 12, 2014 21:04
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.