M
Mick Walker
Hi Folks,
I have a situation where I have a repeater within and ASP Panel on my page.
If the repeater contains no items, then I don't need to show the panel,
however if it does then I do.
I tried the following in the page load event:
// Check to see if we have any new messages
if(repMessages.Items.Count == 0)
{
pnlMessages.Visible = false;
}
if(repMessages.Items.Count > 0 )
{
pnlMessages.Visible = true;
}
However that didn't work, so I figured that the data must be bound after
the page load event fires.So I then tried:
protected void repMessages_ItemDataBound(object sender,
System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
pnlMessages.Visible = true;
}
Thinking that if an item is being databound, then the Items.Count
property of the repeater must be > 0. However that didn't work either.
So my question is, How can I show and hide a panel which contains a
repeater based on the content (or lack of) of the repeater itself?
Kind Regards
Mick
I have a situation where I have a repeater within and ASP Panel on my page.
If the repeater contains no items, then I don't need to show the panel,
however if it does then I do.
I tried the following in the page load event:
// Check to see if we have any new messages
if(repMessages.Items.Count == 0)
{
pnlMessages.Visible = false;
}
if(repMessages.Items.Count > 0 )
{
pnlMessages.Visible = true;
}
However that didn't work, so I figured that the data must be bound after
the page load event fires.So I then tried:
protected void repMessages_ItemDataBound(object sender,
System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
pnlMessages.Visible = true;
}
Thinking that if an item is being databound, then the Items.Count
property of the repeater must be > 0. However that didn't work either.
So my question is, How can I show and hide a panel which contains a
repeater based on the content (or lack of) of the repeater itself?
Kind Regards
Mick