title: RowFilter on a DataTable to display in a gridview
body: <p>I have the following code which doesn't seem to work. In the Page_Load function I populate the DataSet and display the results in a grid view.</p>
  
  <pre><code>newsCommand = new SqlCommand("SQL code here", dbConnection);
  newsDataSet = new DataSet();
  newsDataAdapter = new SqlDataAdapter(newsCommand);
  newsDataAdapter.SelectCommand = newsCommand;
  newsDataAdapter.Fill(newsDataSet, "Bulletins");
  
  if (!Page.IsPostBack)
  {
      GridViewMain.DataSource = newsDataSet;
      GridViewMain.DataBind();
  }
  </code></pre>
  
  <p>I have some links which call this function to filter the data (yearID is passed as a parameter):</p>
  
  <pre><code>DataTable newsTable = new DataTable();
  newsTable = newsDataSet.Tables[0];
  
  DataView dvData = new DataView(newsTable);
  dvData.RowFilter = "Year &gt; '" +  yearID + "'";
  
  GridViewMain.DataSource = dvData;
  GridViewMain.DataBind();
  </code></pre>
  
  <p>Yet the gridview shows the data it orignally loaded, and not the filtered data. The only thing I can think of is that I'm not using the DataTable in the Page_Load function. What else am I missing?</p>
  
  <p>Thanks,</p>
  
  <p>Adrian</p>