Hiding the DataGrid the first time the page loads

Hiding the DataGrid the first time the page loads

When the search page first loads, you can hide the DataGrid that will be used to display the search results.

To hide the DataGrid the first time the page loads:

  1. Open the search page in Code view (View > Code).
  2. Immediately after the Register directive at the top of the page, enter the following code block if the page language is Visual Basic:
    <script runat="server">
    Sub Page_Load()
       If Not IsPostBack Then 
          dgName.Visible = false
       Else
          dgName.Visible = true
       End If
    End Sub
    </script>
    

    where dgName is the ID of your DataGrid.

    If the page language is C#, enter the following code:

    <script runat="server">
    void Page_Load() {
       if (!IsPostBack) { 
          dgName.Visible = false;
       } else {
          dgName.Visible = true;
       }
    }
    </script>
    
  3. Save the page.


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly
Building ColdFusion Applications Rapidly
Building ASP.NET Applications Rapidly
Reference
Building ASP and JSP Applications Rapidly