AI OnAI Off
Not particularly solving your problem, but you might get some hints about how to get block's index: https://github.com/valdisiljuconoks/EPiBootstrapArea/blob/master/README.md#get-block-index-in-the-contentarea
Take a look here Marius: https://hacksbyme.net/2017/06/13/episerver-how-to-know-a-blocks-position-in-a-content-area/
I have a problem getting the content area of the parent page/ block in a block in view mode (in edit mode everything works fine). The main issue I'm trying to solve is to get a blocks position on a page based on it's index.
In my block controller:
In BlockUtilities
The main issue is that parantContentArea is null, when controller runs in view mode while have correct value in editor mode. When I debug ControllerContext?.ParentActionViewContext?.ViewData?.Model have the correct value, but it looks like the casting is not working.
Any suggestions of why the casting is not working, or an other way of getting the contentArea ?