Try our conversational search powered by Generative AI!

Get block type data

Vote:
 

Hi all,

I have a block with name market.

i have another block ads, in that block i want to display market block data.

so how can i achive this using c# backend code not browser.

#174285
Edited, Jan 24, 2017 6:07
Vote:
 

Hi Sandeep,

From what I could understand in Second block you want to show MarketBlock? If that is a case in Second block you need "ContentArea" as below:

public virtual ContentArea Market {get;set;}

And admin can drag and drop an instance of the Market block into that Second block content area you created. Other, way is to have Market block property as below:

public virtual Market Market {get;set;}

That means per each Second block  instance you will have an instance of  Marke means you can't re-use.

Aria

#174286
Jan 24, 2017 7:03
Vote:
 

i want c# code for how to get block data

#174291
Jan 24, 2017 7:30
Vote:
 

if(currentBlock.BlockContentArea != null && currentBlock.BlockContentArea.Items.Any())

{

                 foreach (var contentItem in currentBlock.BlockContentArea.Items)
                {

var contentLoader =   ServiceLocator.Current.GetInstance<IContentLoader>();
 var contentOfBlock = contentLoader.Get<IContentData>(contentItem.ContentLink) 

                }

}

#174296
Jan 24, 2017 9:08
Vote:
 

hi here what is BlockContentArea, and how to declare it. could u provide sample code snippet,

how can i get perticular block type data( my requirement is market).

thnaks in advance

#174342
Edited, Jan 24, 2017 17:25
Vote:
 

can you please give me your properties and what is a requirement?

#174350
Jan 25, 2017 7:10
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.