Hide Controls
Hide Table Control Until Searched

Description
This example uses a search box to retrieve fields based upon the information typed into the search box. Unlike a normal table component that displays results when it is first displayed, the results in this example are displayed only after the application user enters a term into a search box and clicks ?Go?.
Variables
Table
Select table that is being displayed
TableControl
Select a table control
Applies to
TableControl class
Code
 
/// 
/// Override the CreateWhereClause(). If the search text box is empty
/// set RunQuery = False. RunQuery = False will not execute the query for the table.
/// This will return zero records and table control will be empty.
/// 
public override WhereClause CreateWhereClause()
{
    WhereClause wc = base.CreateWhereClause();
    
    // If base.CreateWhereClause() returns nothing,
    // create a new instance of WhereClause.
    if (wc == null)
    {
        wc = new WhereClause();
    }
    
    //  If no value is entered in the search area hide the table control
    if (!MiscUtils.IsValueSelected(this.${Table}Search) && !(this.InSession(this.${Table}Search)))
    {    
        // Set RunQuery = False
        wc.RunQuery = false;
    }
    return wc;
}
     


  Privacy Statement