I have apsx page that has the following simple code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Team.master" AutoEventWireup="True" Inherits="Lib.team" Codebehind="team.aspx.cs" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</asp:Content>
My Behind code is as follow:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace Lib
{
public partial class team : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlDataReader reader = DBData.ExecuteQuery("SELECT * FROM tblTeam");
GridView1. //This is where the error is
}
}
}
My problem is I can’t seem to get the behind code to recognize the control variable GridView1. I am using a web application in VS2010 and below is my project tree:

I think it is something very simple that I missed. I tried to recheck my namespace, my inherit clause, recompile the project. Any help or guidance would be greatly appreciated.
Thanks
I tried all of the steps everyone suggested but no luck… I’m not quite sure why. However, I have a work around as mentioned in one of the comment I wrote. Basically I just convert my project into a Web Site Project and not a web application.
thank you everyone.