CodeCharge Studio |
All ASP PHP Perl ColdFusion Java C#.NET VB.NET |
This example shows how to hide a Grid if no records are found to be displayed within the grid.
Assume that a Responses Grid is located below a Topics grid on a page which implements a forum. You can use the code below to hide the Responses Grid if there are no posted responses.
Function Responses_BeforeShow() If Responses.Recordset.EOF Then Responses.Visible = False End If End Function
function Responses_BeforeShow() {
global $Responses;
if ($Responses->DataSource->RecordsCount == 0) {
$Responses->Visible = False;
}
}sub Responses_BeforeShow() {
if ($Responses->{DataSource}->{RecordsCount} == 0) {
$Responses->{Visible} = 0;
}
}<!---Responses_BeforeShow --->
<CFOUTPUT>#recordCountResponses#</CFOUTPUT>
<CFIF recordCountResponses EQ 0>
<CFSET hideResponses=True>
</CFIF>
'Responses_BeforeShow
If PagesCount = 0 Then
ResponsesRepeater.Visible = False
End if
//Responses_BeforeShow
if (PagesCount == 0) {
ResponsesRepeater.Visible = false;
}
//Responses_BeforeShow
if ( e.getGrid().isEmpty() ) {
e.getGrid().setVisible(false);
}