title: Gridview1 will not update on postback
body: <p>I have a GridView with the below attributes</p>
  
  <pre><code>        AllowSorting="true"
          AutoGenerateColumns="false"
          BorderStyle="None"
          CellPadding="3"
          CssClass="inboundTbl"
          EnableModelValidation="True"
          PageSize="2"
          OnPageIndexChanging="GridView1_PageIndexChanging"
          OnRowDataBound="GridView1_RowDataBound"
          OnSorting="GridView1_Sorting"
          Width="100%"
          &gt;
  </code></pre>
  
  <p>and for some odd reason, it does not like to update when I tried someone's sort tutorial.  Well, this time I'm trying a filter tutorial and I'm really confused on the matter.</p>
  
  <p>This is the templatefield in question.</p>
  
  <pre><code>            &lt;asp:TemplateField HeaderText="Current Terminal ID" SortExpression="VUCTID"&gt;
                  &lt;HeaderTemplate&gt;
                      Terminal:
                      &lt;asp:DropDownList ID="ddlTerminal" runat="server"
                      AppendDataBoundItems="true"
                      AutoPostBack="true"
                      OnSelectedIndexChanged="TerminalChanged"
                      &gt;
                          &lt;asp:ListItem Text="ALL" Value="ALL"&gt;&lt;/asp:ListItem&gt;
                      &lt;/asp:DropDownList&gt;
                  &lt;/HeaderTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;%# Eval("VUCTID") %&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>I've asked for help on why it won't update and he said that the the GridView is populated dynamically, which causes the datatable to return null.  I'm not sure what that means, but I haven't heard from him since.  I'll post the functions to filter as well, just in case the problem lies there.</p>
  
  <pre><code>   protected void Page_Load(object sender, EventArgs e)
      {
          if(!IsPostBack){
              ViewState["Filter"]="ALL";
              BindGridView();
              lastUpdated.Text = "Load: " + DateTime.Now;
          }
      }
  
  protected void BindGridView()
  {
      string query = @"censored";
      using (iDB2Connection conn = new iDB2Connection(connect))
      {
          using (iDB2Command cmd = new iDB2Command(query, conn))
          {
              conn.Open();
              iDB2DataAdapter da = new iDB2DataAdapter(cmd);
              DataSet ds = new DataSet();
              da.Fill(ds);
              DataTable dt = ds.Tables[0];
              GridView1.DataSource = ds;
              //iDB2DataReader reader;
              //reader = cmd.ExecuteReader();
              //GridView1.DataSource = reader;
              GridView1.DataBind();
              GridView1.GridLines = GridLines.Horizontal;
              DropDownList ddlTerminal = (DropDownList)GridView1.HeaderRow.FindControl("ddlTerminal");
              this.BindTerminalList(ddlTerminal);
  
          }
      }
  }
  
  protected void TerminalChanged(object sender, EventArgs e)
  {
      DropDownList ddlTerminal = (DropDownList)sender;
      ViewState["Filter"] = ddlTerminal.SelectedValue;
      this.BindGridView();
  }
  
  private void BindTerminalList(DropDownList ddlTerminal)
  {
      string query = "censored";
      using (iDB2Connection conn = new iDB2Connection(connect))
      {
          using (iDB2Command cmd = new iDB2Command(query, conn))
          {
              conn.Open();
              iDB2DataAdapter da = new iDB2DataAdapter();
              ddlTerminal.DataSource = cmd.ExecuteReader();
              ddlTerminal.DataTextField = "VUCTID";
              ddlTerminal.DataValueField = "VUCTID";
              ddlTerminal.DataBind();
          }
          ddlTerminal.Items.FindByValue(ViewState["Filter"].ToString()).Selected = true;
      }
  }
  </code></pre>
  
  <p>EDIT: Ah I'm sorry.  By update I mean it wouldn't filter the gridview.  The dropdown box in the template will populate from the database and once clicked, the gridview should update and filter according to the selected dropdown item.  But when I click it, the page will load, but the gridview looks unaffected.</p>