Dreamweaver

Hide the DataGrid the first time the page loads (ASP.NET)

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

  1. Open the search page in Code view (View > Code).
  2. Immediately following 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 IfEnd 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.