Note that there are some explanatory texts on larger screens.

plurals
  1. PORefreshing the RowFilter property on a DataView
    text
    copied!<p>Here is what I am trying to do. I have a form, with a 'filter' combobox and a DataGridView on it that displays the data from the database (I have assigned the data using the <code>DataSet.Tables[0].DefaultView</code> property. The combobox has a list of items, found in the database, plus a custom added one (named ). When the user selected one of the items, I the following code is run:</p> <pre><code> int filterID = ( int )this.cbxFilter.SelectedValue; DataView view = this.dgvScenarios.DataSource as DataView; if ( filterID &gt; 0 ) { view.RowFilter = string.Format( "Season = {0}", this.cbxFilter.SelectedValue ); } else { view.RowFilter = string.Empty; } </code></pre> <p>Now, this works very well, as the <code>&lt;All&gt;</code> item is item 0. Now, I can change the 'filtering' property, Season, on the form. That has a similar combobox that has all of the same data in it as the 'filter' box, minus the <code>&lt;All&gt;</code> item. When the user changes this value, this is what is run:</p> <pre><code> if ( this._loading ) { return; } ComboBox cbx = sender as ComboBox; int rows = this.UpdateDataFromControl( cbx.Tag, cbx.SelectedValue ); if ( rows &lt;= 0 ) { return; } this.UpdateDGVCell( cbx.Tag, cbx.SelectedValue, "ID" ); this.UpdateDGVCell( cbx.Tag, cbx.Text, "Text" ); </code></pre> <p>Now, I would think that the DataView would update the data grid, but it does nothing, and I can't figure out how to do this refresh without loading the data into the dataset again, which would be a hit to performance as I am accessing the database, again, and then filtering it out. Am I missing something that I haven't found on Google yet? Thanks for any help, and if anymore information is needed, please let me know!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload