C# GridView doesnt show
<p>Working on a basic C# web app here and I can't seem to get the GridView to show. I can see that its passing the code through because it changes my image from one to another but for some reason the Gridview doesn't show up. Using the button for the postback and my dropdown box has the variable for my stored procedure. Im new to C# web apps (Vb Win app guy here) so I need a little guidance please. </p>

<p>Thanks!</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //This is where my postback begins...
        if (IsPostBack)
        {
            string Quote = null;

            System.Data.SqlClient.SqlConnection myDatabaseConnection = null;
            System.Data.SqlClient.SqlCommand myCommand = null;
            System.Data.SqlClient.SqlDataReader myReader = null;

            // Validate the SP
            Page.Validate();
            if (Page.IsValid)
            {
                Quote = DropDownList1.Text.ToString();

                try
                {
                    string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["Data1"].ConnectionString;
                    myDatabaseConnection = new System.Data.SqlClient.SqlConnection(connectionString);
                    myCommand = new System.Data.SqlClient.SqlCommand();

                    //Set up to use my stored procedure:
                    myCommand.CommandType = System.Data.CommandType.StoredProcedure;
                    myCommand.Connection = myDatabaseConnection;
                    myCommand.CommandText = "EditDataPage";
                    myCommand.Parameters.AddWithValue("@QuoteNumber", Quote);


                    //Use an SqlDataReader to execute the stored procedure and
                    //get the results into the GridView:
                    myDatabaseConnection.Open();
                    myReader = myCommand.ExecuteReader();
                    GridView1.DataSource = myReader;
                    GridView1.DataBind();
                    myDatabaseConnection.Close();
                    myDatabaseConnection.Dispose();
                    GridView1.Visible = true;
                    Image1.Visible = false;
                    Image2.Visible = true;
                }
                catch (System.Data.SqlClient.SqlException exception)
                {
                    ErrorLabel.Visible = true;
                }
                catch (Exception exception)
                {
                    ErrorLabel.Visible = true;
                    //Do cleanup tasks here:
                }
                finally
                {
                    myCommand = null;

                    if ((myReader != null) &amp;&amp; !myReader.IsClosed)
                    {
                        myReader.Close();
                    }

                    myReader = null;

                    if ((myDatabaseConnection != null) &amp;&amp; myDatabaseConnection.State == System.Data.ConnectionState.Open)
                    {
                        myDatabaseConnection.Close();
                        myDatabaseConnection.Dispose();
                    }

                    myDatabaseConnection = null;
                }
            }
        }
    }

}
</code></pre>

<hr>

<p>Heres my aspx code: </p>

<p>
    <h3>
        Edit Data</h3></p>

<p>
    &nbsp;Use the controls to move within the dataset, then edit and save what you need 
    for your reports.
</p>

<pre><code>&lt;table class="yui-d0f"&gt;
    &lt;/table&gt;
&lt;table class="yui-main"&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="&lt;%$ ConnectionStrings:Data1 %&gt;" 
                SelectCommand="EditDataPage" SelectCommandType="StoredProcedure"&gt;
                &lt;SelectParameters&gt;
                    &lt;asp:FormParameter FormField="DropDownList1" Name="QuoteNumber" Type="String" /&gt;
                &lt;/SelectParameters&gt;
            &lt;/asp:SqlDataSource&gt;
            &lt;table class="style1"&gt;
                &lt;tr&gt;
                    &lt;td align="center"&gt;
                        &lt;asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="DropDownList" 
                            DataTextField="QuoteNumber" DataValueField="QuoteNumber" Height="23px" 
                            Width="188px"&gt;
                        &lt;/asp:DropDownList&gt;
                        &lt;asp:SqlDataSource ID="DropDownList" runat="server" 
                            ConnectionString="&lt;%$ ConnectionStrings:Data1 %&gt;" 
                            SelectCommand="SELECT QuoteNumber FROM SF1411 GROUP BY QuoteNumber"&gt;
                        &lt;/asp:SqlDataSource&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;table class="style1"&gt;
                            &lt;tr&gt;
                                &lt;td class="style2"&gt;
            &lt;asp:Button ID="ListAllButton" runat="server" Height="32px" Text="Show Data" 
                Width="111px" PostBackUrl="~/EditData.aspx" /&gt;
                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;asp:Image ID="Image1" runat="server" 
                                        ImageUrl="~/_assets/img/lock-disabled-icon.png" /&gt;
                                    &lt;asp:Image ID="Image2" runat="server" ImageUrl="~/_assets/img/lock-icon.png" 
                                        Visible="False" /&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                        &lt;/table&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;
            &lt;asp:Label ID="ErrorLabel" runat="server" Font-Underline="True" 
                ForeColor="Maroon" Text="Error in Processing, try again later." Visible="False"&gt;&lt;/asp:Label&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;

&lt;asp:GridView ID="GridView1" runat="server" CssClass="styled" 
    AutoGenerateColumns="False"&gt;
&lt;/asp:GridView&gt;
</code></pre>
