I am trying to get the block of a CurrentPage (if it a specific page) in Root.Master.cs, but I am unable to find the way, how to do it.
I have tried to load block with its ID (a static number), but Reviewer says you need to find another way.
public MapMode CurrentMapMode
{
get
{
if (!(CurrentPage is EstateDisplayPage))
return MapService.GetMapMode(Request.QueryString, CurrentPage as ISiteWithMap);
var block = ServiceLocator.Current.GetInstance<IContentLoader>()
.Get<IContent>(new ContentReference(10861)); //MapBlock ID: 10861
return MapService.GetMapMode(Request.QueryString, block as ISiteWithMap);
}
}
I need to find another way to finding block, where I dont need to pass the static number (ID) to ContentRefrence. Thanks in advance
That is what I have done to get the
Blocksof Specific Page onRoot.Master.cs.