First GridView dissapears when binding a second GridView in code
<p>I'm having a problem with a couple of gridviews that are filled from the code behind.
When I fill and databind GridView1 on it's own it works fine.
I then added the code to fill and bind GridView2 which displays but GridView1 dissapears completely.
If I comment out GridView2.DataBind() then GridView1 then appears again.
I can't work out what is going on.</p>

<p>Incidentaly if I change GridView2 for a DropDownList or a CheckBoxList then the same problem occurs, but if I change it for a ListBox then GridView1 appears.</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{


    Int32 chaID = 20;
    Int32 slots = 14;

    String ConnectionString = WebConfigurationManager.ConnectionStrings["horizonConnectionString"].ToString();
    String selectSQL = "SELECT chassis.ChassisName, srv.ChassisPosition, srv.ServerName, srv.ChassisID, srv.LocationID, chassis.LocationID AS ChaLocationID FROM srv INNER JOIN chassis ON srv.ChassisID = chassis.ChassisID WHERE (srv.ChassisID = '" + chaID + "') ORDER BY chassis.ChassisName, srv.ChassisPosition";
    SqlConnection con = new SqlConnection(ConnectionString);
    SqlCommand cmd = new SqlCommand(selectSQL, con);
    DataTable dt2 = new DataTable();
    DataView dv = new DataView();

    try
    {
        con.Open();

        SqlDataAdapter sda = new SqlDataAdapter(selectSQL, con);
        sda.Fill(dt2);
        dv = dt2.DefaultView;


    }
    catch (Exception)
    {

    }


    try
    {

        int searchIndex;
        dv.Sort = "ChassisPosition";

        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("Bay", typeof(Int32)));
        dt.Columns.Add(new DataColumn("Server", typeof(String)));

        for (int i = 0; i &lt;= slots - 1; i++)
        {
            DataRow dr = dt.NewRow();
            dr[0] = i + 1;

            searchIndex = dv.Find(i + 1);

            if (searchIndex != -1)
            {
                dr[1] = dv[searchIndex][2].ToString();
            }
            else
            {
                dr[1] = "-----";

            }

            dt.Rows.Add(dr);
        }

        this.GridView1.DataSource = dt;
        GridView1.DataBind();


    }
    catch (Exception)
    {

    }


        ConnectionString = WebConfigurationManager.ConnectionStrings["horizonConnectionString"].ToString();

        selectSQL = "SELECT [ServerName], [ServerID], [FarmName], [LMG] FROM [srv] ORDER BY [ServerName]";
        con = new SqlConnection(ConnectionString);
        cmd = new SqlCommand(selectSQL, con);
        DataTable dt3 = new DataTable();


        try
        {
            con.Open();

            SqlDataAdapter sda = new SqlDataAdapter(selectSQL, con);
            sda.Fill(dt3);

            this.GridView2.DataSource = dt3;
            GridView2.DataBind();


        }
        catch (Exception)
        {

        }

    }
</code></pre>
