title: The name gridview1 does not exist in the current context
body: <p>I am new to C#. Just following YouTube simple example and trying to simply connect to SQL database. But <code>GridView1</code> gives me an error.
  Thes is my WebForm1.aspx.cs </p>
  
  <pre><code>using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data.SqlClient;
  using System.Data.OleDb;
  using System.Data.Odbc;
  
  
  
  namespace adoDemo
  {
      public partial class WebForm1 : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {
              String CS = "data source =.; database = AdventureWorks2016CTP3; integrated security = SSPI";
              SqlConnection con = new SqlConnection(CS);
              SqlCommand cmd = new SqlCommand("select top 5 * from [Sales].[CreditCard]", con);
              con.Open();
              GridView1.DataSource = cmd.ExecuteReader();
              GridView1.DataBind();
              con.Close();
          }
      }
  }
  </code></pre>
  
  <p>This is WebForm.aspx.designer.cs </p>
  
  <pre><code>//------------------------------------------------------------------------------
  // &lt;auto-generated&gt;
  //     This code was generated by a tool.
  //
  //     Changes to this file may cause incorrect behavior and will be lost if
  //     the code is regenerated. 
  // &lt;/auto-generated&gt;
  //------------------------------------------------------------------------------
  
  namespace adoDemo {
  
  
      public partial class WebForm1 
      {
  
          /// &lt;summary&gt;
          /// form1 control.
          /// &lt;/summary&gt;
          /// &lt;remarks&gt;
          /// Auto-generated field.
          /// To modify move field declaration from designer file to code-behind file.
          /// &lt;/remarks&gt;
          protected global::System.Web.UI.HtmlControls.HtmlForm form1;
      }
  }
  </code></pre>
  
  <p>And this is WebForm1.aspx</p>
  
  <pre><code>   &lt;script runat="server"&gt;
  
      Protected Sub Unnamed1_SelectedIndexChanged(sender As Object, e As EventArgs)
  
      End Sub
  &lt;/script&gt;
  body 
  
  &lt;asp:gridview id="GridView1" runat="server" OnSelectedIndexChanged="Unnamed1_SelectedIndexChanged" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"&gt;
      &lt;FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /&gt;
      &lt;HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /&gt;
      &lt;PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /&gt;
      &lt;RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /&gt;
      &lt;SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /&gt;
      &lt;SortedAscendingCellStyle BackColor="#FFF1D4" /&gt;
      &lt;SortedAscendingHeaderStyle BackColor="#B95C30" /&gt;
      &lt;SortedDescendingCellStyle BackColor="#F1E5CE" /&gt;
      &lt;SortedDescendingHeaderStyle BackColor="#93451F" /&gt;
  &lt;/asp:gridview&gt;
  </code></pre>
  
  <p>This is how my <code>WebForm1.aspx.designer.cs</code> looks like</p>
  
  <p><a href="https://i.stack.imgur.com/UH5WR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UH5WR.png" alt="enter image description here"></a>
  Is there anything I'm missing?</p>