title: ASP.NET Gridview not showing
body: <p>ok so im sure the problem is in the code behind, something is not right..</p>
  
  <p>DAL is a class that gets data from the db, and it works, for sure..</p>
  
  <p><strong>code behind:</strong></p>
  
  <pre><code>using DALLib;
  using System;
  using System.Collections.Generic;
  using System.Configuration;
  using System.Data;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  namespace FinalProject
  {
      public partial class בתים : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {
              if (!IsPostBack)
              {
                  MaxRooms.Attributes.Add("onChange", "return OnSelectedIndexChange()");
                  MinRooms.Attributes.Add("onChange", "return OnSelectedIndexChange()");
  
                  Cities.DataSource = (DataTable)Application["CitiesTable"];
                  Cities.DataTextField = "Name";
                  Cities.DataBind();
              }
  
              DAL findHouses = new DAL(
                  "SELECT * FROM Houses WHERE City='" + Cities.Text + "' AND Rooms BETWEEN '" + MinRooms.Text + "' AND '" + MaxRooms.Text + "'",
                  ConfigurationManager.AppSettings["ConnectionString"],
                  "Houses"
                  );
  
              Application.Lock();
              Application["SearchResultsTable"] = findHouses.GetTable();
              Application.UnLock();
  
          }
  
          protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
          {
              SearchResults.PageIndex = e.NewPageIndex;
              BindHousesToGrid();
          } 
  
          private void BindHousesToGrid()
          {
              SearchResults.DataSource = (DataTable)Application["SearchResultsTable"];
              SearchResults.DataBind();
          }
  
      }
  }
  </code></pre>
  
  <p><strong>the form:</strong></p>
  
  <pre><code>&lt;div&gt;
      &lt;asp:GridView ID="SearchResults" runat="server" CellPadding="4" GridLines="None" AutoGenerateColumns="False" ForeColor="#333333" AllowPaging="True"&gt;
          &lt;AlternatingRowStyle BackColor="White"&gt;&lt;/AlternatingRowStyle&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="Id" HeaderText="מספר נכס" /&gt;
              &lt;asp:BoundField DataField="City" HeaderText="עיר" /&gt;
              &lt;asp:BoundField DataField="Street" HeaderText="רחוב" /&gt;
              &lt;asp:BoundField DataField="Rooms" HeaderText="חדרים" /&gt;
              &lt;asp:BoundField DataField="size" HeaderText="גודל" /&gt;
              &lt;asp:BoundField DataField="price" HeaderText="מחיר" /&gt;
          &lt;/Columns&gt;
          &lt;FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White"&gt;&lt;/FooterStyle&gt;
  
          &lt;HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White"&gt;&lt;/HeaderStyle&gt;
  
          &lt;PagerStyle HorizontalAlign="Center" BackColor="#FFCC66" ForeColor="#333333"&gt;&lt;/PagerStyle&gt;
  
          &lt;RowStyle BackColor="#FFFBD6" ForeColor="#333333"&gt;&lt;/RowStyle&gt;
  
          &lt;SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy"&gt;&lt;/SelectedRowStyle&gt;
  
          &lt;SortedAscendingCellStyle BackColor="#FDF5AC"&gt;&lt;/SortedAscendingCellStyle&gt;
  
          &lt;SortedAscendingHeaderStyle BackColor="#4D0000"&gt;&lt;/SortedAscendingHeaderStyle&gt;
  
          &lt;SortedDescendingCellStyle BackColor="#FCF6C0"&gt;&lt;/SortedDescendingCellStyle&gt;
  
          &lt;SortedDescendingHeaderStyle BackColor="#820000"&gt;&lt;/SortedDescendingHeaderStyle&gt;
      &lt;/asp:GridView&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>the button on my form doesnt do anything yet, but first i want the gridview to show the initial values, means the whole db table..
  what am i doing wrong?</p>