I’m curious about this in the case that I have a repeater that I want to hide if there are 0 items. As far as performance goes should I be doing this:
if (data.Count > 0)
{
rpt.DataSource = data;
rpt.DataBind();
rpt.Visible = true;
}
else
{
rpt.Visible = false;
}
or is it fine to just do this:
rpt.DataSource = data;
rpt.DataBind();
rpt.Visible = data.Count() > 0;
Thanks!
It does a databind, but doens’t show anything. For example, if you have a datagrid, and try to bind somme data with empty datasource, it will not display anything, unless you have set EmptyDataText property of the datagrid to some text. In this case, it will display this text