We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Create a history with a GridDataBoundGrid

Hello. I''m trying to create a history window for my application. The requirments are: - adding row by the top - setting max number of rows - add a row per half a second I''v chosen a GridDataBoundGrid to do that. But i have some issues with selection in the grid and the painting. Do you think GridDataBoundGrid is the good choice to do that? Thank you.

7 Replies

AD Administrator Syncfusion Team June 7, 2005 12:06 PM UTC

If you are using multiple threads, then you need to make sure you only interact with the grid only on the thread that created it. If your data is in a DataTable, then inserting new rows using DataTable.Rows.Insert at the top will not work if you are going to allow editing/sorting. If you are using a custom collecttion that supports insert properly, or an arraylist of objects, then I think things should work OK in a GridDataBoundGrid (unless there are threading issues or something else causing a problem). If you can upload a sample project showing the problem you see, maybe we can suggest a solution.


JG Julien Goldberg June 8, 2005 11:02 AM UTC

Thank you for your answer. There was an issue with threads and an another one with the optimization of the grid. When you are saying that i should use a "custom collecttion that supports insert properly", does it mean that a DataTable is not proper? Second thing. I''m using filter with this Grid. But because of the adding/removing, filters don''t match the value in the grid, unless wired/unwired filters for each adding/removing. Thanks for your time. >If you are using multiple threads, then you need to make sure you only interact with the grid only on the thread that created it. > >If your data is in a DataTable, then inserting new rows using DataTable.Rows.Insert at the top will not work if you are going to allow editing/sorting. > >If you are using a custom collecttion that supports insert properly, or an arraylist of objects, then I think things should work OK in a GridDataBoundGrid (unless there are threading issues or something else causing a problem). > >If you can upload a sample project showing the problem you see, maybe we can suggest a solution.


AD Administrator Syncfusion Team June 8, 2005 01:48 PM UTC

I mean DataTable.Rows.InsertAt does not work (event in a Windows Forms DataGrid) if you try to sort things. Dropdown items not updating is a limitation on the GridDataBoundGrid FilterBar. The FilterBar support in our GridGroupingControl does not have this limitation. If you want the dropdown to reflect changes in the grid, you can derive the GridFilterbar and handle the grid.CurrentCellShowingDropDown event and set the unique values there. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GDBG_DynamicFilterBar_fd1bd7c3.zip


JG Julien Goldberg June 20, 2005 10:16 AM UTC

Thank you very much. Just a little problem, i think i ve miss something, but i can''t resize the combo box when i m trying to filter. I v always 2 places (for none and custom)and a scroll bar. Thx. >I mean DataTable.Rows.InsertAt does not work (event in a Windows Forms DataGrid) if you try to sort things. > >Dropdown items not updating is a limitation on the GridDataBoundGrid FilterBar. The FilterBar support in our GridGroupingControl does not have this limitation. > >If you want the dropdown to reflect changes in the grid, you can derive the GridFilterbar and handle the grid.CurrentCellShowingDropDown event and set the unique values there. Here is a little sample. > >http://www.syncfusion.com/Support/user/uploads/GDBG_DynamicFilterBar_fd1bd7c3.zip


AD Administrator Syncfusion Team June 20, 2005 10:23 AM UTC

To size a combobox dropdown, you set its DropDownRows property (usually in CurrentCellShowingDropDown). Here is a forum link with some code snippets. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=24390


AA Aaron Andreson August 3, 2005 05:23 PM UTC

When I used this sample to replace my GridFilterBar for my GDBG I noticed something a bit peculiar. The first click to drop the filter bar down listed all of the entries, but they were not sorted or unique. The second click while the combo box was expanded sorted the list and only had unique entries. I noticed that if the grid was sorted to the column I expanded, then the first click produced the correctly sorted and unique only list. Any thoughts on this? Aaron >I mean DataTable.Rows.InsertAt does not work (event in a Windows Forms DataGrid) if you try to sort things. > >Dropdown items not updating is a limitation on the GridDataBoundGrid FilterBar. The FilterBar support in our GridGroupingControl does not have this limitation. > >If you want the dropdown to reflect changes in the grid, you can derive the GridFilterbar and handle the grid.CurrentCellShowingDropDown event and set the unique values there. Here is a little sample. > >http://www.syncfusion.com/Support/user/uploads/GDBG_DynamicFilterBar_fd1bd7c3.zip


AD Administrator Syncfusion Team August 3, 2005 05:58 PM UTC

The CreateUniqueEntroes method assumes the passed-in DataView is sorted. So, in the sample, using this code made things work for me. private void grid_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e) { GridDataBoundGrid grid = this.GetGrid(); GridCurrentCell cc = grid.CurrentCell; if(cc.RowIndex == this.GetFilterRow()) { int field = grid.Binder.ColIndexToField(cc.ColIndex); string colName = grid.GridBoundColumns.Count > 0 ? grid.GridBoundColumns[field].MappingName : grid.Binder.InternalColumns[field].MappingName; GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; DataView dv = new DataView(this.GetDataTable(), "", colName, DataViewRowState.CurrentRows); cr.ListBoxPart.DataSource = this.CreateUniqueEntries(dv, colName); } }

Loader.
Live Chat Icon For mobile
Up arrow icon