CodeCharge Studio All ASP PHP Perl ColdFusion Java C#.NET VB.NET

Restricting SQL Execution for Components Hidden Using a Panel

When using PHP, ASP or Perl; hiding a panel means that SQL queries will not be performed for any form included into the Panel. When using Java or .NET the data reading is performed prior to it being displayed, therefore it is necessary to use custom code that sets the component's AllowRead property to False if panel's Visibility property is False. The following custom code can be added in the page's After Initialize and component's Before Select events:

Java - After Initialize event

for (Iterator it = e.getPage().getPanel("Panel1").getComponents().iterator(); 
it.hasNext(); ) { 
  Object obj = it.next();
  if (obj instanceof Component) {
    ((Component) obj).setAllowRead(false);
  }
}

C# - After Initialize event

For each container component with the specified datasource add the code below:

<componentName>Operations.AllowRead = <componentName>Operations.AllowRead && <panelName>.Visible;

For example, if Grid 'MyGrid' is inserted into Panel 'MyPanel' the code line should look like the following:

MyGridOperations.AllowRead = MyGridOperations.AllowRead && MyPanel.Visible;

VB - After Initialize event

For each container component with the specified datasource add the code below:

<componentName>Operations.AllowRead = <componentName>Operations.AllowRead AndAlso <panelName>.Visible

For example, if Grid 'MyGrid' is inserted into Panel 'MyPanel' the code line should look like the following:

MyGridOperations.AllowRead = MyGridOperations.AllowRead AndAlso MyPanel.Visible

See also


On-line, printable versions and updates