Databound Grid on Panel

I have developed some databound grid with a filter bar on it. Everything is ok. For some reason I need to place the datagrid on a panel. If I do that the Filter bar will not work... I get the following error: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: colIndex I used the samples to create the filter bar and my code looks like this: dsStock = new DataSet(); this.adptStock.Fill(this.dsStock); this.Cursor = Cursors.WaitCursor; this.dgStock.BeginUpdate(); this.dgStock.DataSource = dsStock.Tables[0]; this.dgStock.Model.ColWidths.ResizeToFit(GridRangeInfo.Row(0), GridResizeToFitOptions.NoShrinkSize); this.dgFilterBar = new GridFilterBar(); this.dgFilterBar.WireGrid(this.dgStock); this.dgStock.EndUpdate(); this.Cursor = Cursors.Arrow; The debugger highlights this line when the error strikes: this.dgStock.EndUpdate(); Again without the panel everything is perfect. The filter bar does the job.

2 Replies

AD Administrator Syncfusion Team July 6, 2003 04:01 PM UTC

The grid inherits its binding context from its parent so try setting the grid's BindingContext to the BindingContext of the form to see if that makes things work. this.dgStock.BindingContext = this.BindingContext;


XP XP July 6, 2003 07:43 PM UTC

It works. Thanks again Clay!

Loader.
Up arrow icon