Developer forum

Forum » CMS - Standard features » Check if a template area has content

Check if a template area has content

Adrian Ursu
Reply

Hi Guys,

Is there any way to check if a template area (dwcontent) has something in it?

I need to show/hide some zreas based on the presence or absence of paragraphs in a template area.

I am using Razor.

Thanks,

Adrian


Replies

 
Thomas Schroll
Reply

Hi Adrian

If you mean the paragraph content I think you can use:

@if (!string.IsNullOrEmpty(GetString("DwContent(paragraphareaname)"))) {

<div class="dwcontent" id="paragraphareaname"></div>

}

Regards Thomas

 
Adrian Ursu
Reply

Hi Thomas,

 

That's exactly what I needed.

Thanks a lot!

Adrian

 

You must be logged in to post in the forum