Below is a modified WireGrid method that raises the event.
public override void WireGrid(Syncfusion.Windows.Forms.Grid.GridDataBoundGrid grid, Syncfusion.Windows.Forms.Grid.GridStyleInfo style)
{
if(_grid != null)
UnwireGrid();
if(grid != null)
{
_dataTable = grid.DataSource as DataTable;
if(_dataTable == null)
{
DataSet ds = grid.DataSource as DataSet;
if(ds != null)
{
_dataTable = ds.Tables[grid.DataMember];
}
}
if(_dataTable != null)
{
//add a fixed row at the top
grid.Model.Data.RowCount++;
grid.Model.Rows.HeaderCount++;
int _row = grid.Model.Rows.HeaderCount;
grid.Model.Rows.FrozenCount = grid.Model.Rows.FrozenCount + 1;
grid.Model.ChangeCells(GridRangeInfo.Cells(_row, 1, _row, grid.Model.ColCount), style, StyleModifyType.Override);
GridBoundColumnsCollection gbcc;
gbcc = (grid.GridBoundColumns.Count == 0) ? grid.Binder.InternalColumns : grid.GridBoundColumns;
GridBorder border = grid.BaseStylesMap["Standard"].StyleInfo.Borders.Right;
for(int gbcIndex = 0; gbcIndex < gbcc.Count ; ++gbcIndex)
{
string colName = gbcc[gbcIndex].MappingName;
int col = grid.Binder.NameToColIndex(colName);
GridFilterBarCreatingColumnHeaderEventArgs e = new GridFilterBarCreatingColumnHeaderEventArgs(colName);
OnCreatingColumnHeader(e);
if(e.Cancel)
{
// grid[_row, col].Enabled = false;
grid[_row, col].CellType = "Static";
continue;
}
grid[_row, col].Borders.Right = border;
}
grid.CurrentCellChanged += new EventHandler(grid_FilterCellChanged);
}
}
_grid = grid;
}
Stefan
>After attached the filterbar, I cannot disable the cell based on grid cooridate.
>as grid[1,2].Enabled=false;
>
>I do need to get cells disabled even before the cell change event is triggerred.
>Is there a quick way to get GridFilterBarCreatingColumnHeaderEventHandler implented?
>
>I tried but not really works
>
>thanks
>
>>You are right. This event is not implemented for the sample code, but you should be fine without it.
>>
>>You can decide in the grid_FilterCellChanged event whether you want changing the contents of the cell affect the dataset filter.
>>
>>Another option would be to set the cells .Enabled flag to false. Then the user can''t type into the cell.
>>
>>Stefan
>>
>>>
>>>Hi Stefan,
>>>
>>>I believe after the change, this line is not workign
>>> theFilterBar.CreatingColumnHeader += new GridFilterBarCreatingColumnHeaderEventHandler(GridFilterBarCreatingColumnHeader);
>>>
>>>Basically, I can not disable any column in the filter bar. Any suggestions?
>>>thanks a lot
>>>
>>>
>>>>I attached a sample project that implements such behavoir:
>>>>
>>>>
FilterBarTextBoxGrid_8008.zip
>>>>
>>>>Stefan
>>>>
>>>>>Can I change the dropdown list type from gridFilterBar so I can find the right item by typing multiple letters?For example, if there is something called Syncfusion in the list, I would like to jump to that item by typing Sync. Now whenever I type a new letter the search will restart from that letter.
>>>>>Thanks
>>>>