Portal Engine
Version 2.x > Portal Engine > hide datalist web part container and title if returns no data View modes: 
User avatar
Member
Member
marie - 5/2/2007 10:40:13 PM
   
hide datalist web part container and title if returns no data
Does anyone know of how to hide the datalist web part container title and the web part container if the datalist doesn't return any data?

I have the 'Hide if no record fount' checked; but that only hides the actual datalist if no records are found not the container.

I have been trying to write some login in the web part code tab - but can't seem to get it to work.

Please, any help is greatly appreciated.

Thanks,
Marie

User avatar
Member
Member
petrpa@kentico.com - 5/11/2007 4:32:04 PM
   
RE:hide datalist web part container and title if returns no data
To hide both (datalist and cointainer) if datalist cointains no data, follow this procedure:

Configure the datalist webpart -> Tab Code and insert following script:

<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this.lstElem.Items.Count == 0)
{
this.Visible = false;
}
}
</script>