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

DropGrid Behavior

I have DropGrids within a Grid. I want the drop down fuctioning similar to a GridList, except I want to add sorting and filtering. I have some of it working, but I'm having 3 problems. 1)How do I make the value post back from the drop down grid to the containing cell? 2)How do I automatically scroll to the the current value when the grid is displayed. (Summed up... How do I keep the cell text and the selected grid row in sync?) 3)When I try to wire the grid, I get an argument out of range exception. //note: gridAttributes is the main grid //drop grid gridDrop = new Syncfusion.Windows.Forms.Grid.GridDataBoundGrid(); gridDrop.DataSource = valueTable; gridDrop.ThemesEnabled = true; gridDrop.CausesValidation = false; gridDrop.CellClick += new Syncfusion.Windows.Forms.Grid.GridCellClickEventHandler(gridDrop_CellClick); gridDrop.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.One; gridDrop.CurrentCellActivating += new Syncfusion.Windows.Forms.Grid.GridCurrentCellActivatingEventHandler(gridDrop_CurrentCellActivating); gridDrop.TableStyle.CellType = "Static"; gridDrop.Model.Cols.Hidden[0] = true; //wire filter if(this.filterBar != null && this.filterBar.Wired) { //reset this.filterBar.RowFilter = ""; this.filterBar.UnwireGrid(); } this.filterBar = new Syncfusion.Windows.Forms.Grid.GridFilterBar(); this.filterBar.WireGrid(this.gridDrop); //apply grid to cell cellModel = new DropDownGridCellModel(this.gridAttributes.Model); cellModel.EmbeddedGrid = gridDrop; string gridDropCell = "GridDropCell" + gridrow.ToString(); gridAttributes.CellModels.Add(gridDropCell,cellModel); this.gridAttributes[gridrow,2].Text = row["ITEM_ATTR_VALUE"].ToString(); this.gridAttributes[gridrow,2].CellType = gridDropCell;

3 Replies

AD Administrator Syncfusion Team July 24, 2003 08:31 PM UTC

To handle 1 and 2, you might try CurrentCellShowingDropDown and CurrentCellCloseDropDown. In showing dropdown, grab the value from the parent grid cell, and use it (somehow, don't know how???) to set the CurrentCell (using grid,CurrentCell.MoveTo) to position the currentcell in the dropped grid. In CurrentCellClose, go the other way setting the parent cell value from the dropped grid. You could also use CurrentCellShowingDropDown to dynamically set the drop grid's DataSource if you want it to work that way. For 3), is the same datasource being bound to multiple grids? If so, then they all will have the same current position unless you force them to use different bindingcontext.


EH Erik Huynh April 4, 2005 05:05 PM UTC

We bought the software 2 months ago. I used GridFilterBar within the Syncfusion.Windows.Forms.Grid.GridDataBoundGrid as the sample. It is fine the first Wire to the grid, but after I code the Refresh functionality (I create the new GridFilterBar() and new filter string, and Wire it to the Grid again with the changed DataSource in the Grid already. Then the FilterBar just disappear even the code is like the first time, that I Wire it. Could you please show me how to UnWired and re-wire to the just-changed datasource GridDataBoundGrid. It is best if you have time and creating a sample C# project for this problem. Thank you very much for your help. Erik Huynh >To handle 1 and 2, you might try CurrentCellShowingDropDown and CurrentCellCloseDropDown. In showing dropdown, grab the value from the parent grid cell, and use it (somehow, don''t know how???) to set the CurrentCell (using grid,CurrentCell.MoveTo) to position the currentcell in the dropped grid. In CurrentCellClose, go the other way setting the parent cell value from the dropped grid. > >You could also use CurrentCellShowingDropDown to dynamically set the drop grid''s DataSource if you want it to work that way. > >For 3), is the same datasource being bound to multiple grids? If so, then they all will have the same current position unless you force them to use different bindingcontext.


AD Administrator Syncfusion Team April 4, 2005 11:08 PM UTC

I am not sure what you are asking. But here is a sample with a button that loads a grid showing a filterbar with different data every time you click the button. http://www.syncfusion.com/Support/user/uploads/GDBG_Filter_8d597810.zip

Loader.
Live Chat Icon For mobile
Up arrow icon