The default behavior of the filterbar cell is not to accept the setting of its text. But using an event like DrawcellDiplsyText gets around this limitation. If you want to ''set'' a value in a button handler, then you could set these values in some variable (or arraylist or hashtable if you need to hold several), and then use these cached values in DrawCellDisplaytext to provide the value you want to see. To find th efilterbar row, you can look for something like the AddNewRow and then use that location to get at the filter bar row. (or, you could look for grid.Table.FilteredRecords[0] if you are not using the AddnewRow at the top.)
public string criteria = "";
private void groupingGrid1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style;
if (style.TableCellIdentity.TableCellType == GridTableCellType.FilterBarCell
&& style.TableCellIdentity.Column.MappingName == "ContactTitle"
&& criteria.Length > 0)
{
e.Inner.DisplayText = criteria;
}
}
private void button1_Click(object sender, System.EventArgs e)
{
Record rec = this.groupingGrid1.Table.AddNewRecord;
int row = this.groupingGrid1.Table.DisplayElements.IndexOf(rec);
int field = this.groupingGrid1.TableDescriptor.NameToField("ContactName");
int col = this.groupingGrid1.TableDescriptor.FieldToColIndex(field);
criteria = "CriteriaText";
this.groupingGrid1.TableControl.RefreshRange(GridRangeInfo.Row(row-1));
}