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

GridListControl celltype

Hi, I have a cell formatted like: gbcc["Code"].StyleInfo.DataSource = new DataView(this.dataSet351.paycodes, "bktype=''" + this.bktype + "''", "[Pay Code]", DataViewRowState.CurrentRows); gbcc["Code"].StyleInfo.CellType = "GridListControl"; gbcc["Code"].StyleInfo.DropDownStyle = GridDropDownStyle.AutoComplete; gbcc["Code"].StyleInfo.CellValueType = typeof(String); gbcc["Code"].StyleInfo.DisplayMember = "Pay Code"; gbcc["Code"].StyleInfo.ValueMember = "Pay Code"; was wondering how to hide the bktype col which is needed only for filtering, and be able to right justify another string column. a strange thing that happens is the more i drop the gridlist down the wider the last col gets. thanks

2 Replies

AD Administrator Syncfusion Team September 24, 2004 07:37 PM UTC

Hi Colin, Hiding Column: -------------- You can hide the columns in the dropdown list by accessing the embedded grid in CurrentCellShowingDropDown. Please refer this KB article: http://www.syncfusion.com/Support/article.aspx?id=10353 // Adjust the properties in the Embedded Grid cr.ListControlPart.Grid.ColWidths[1] = 30; cr.ListControlPart.Grid.SetRowHidden(1,2,true); Alignment: ---------- You can subscribe to the Grid''s PrepareViewStyleInfo to set the horizontal alignment. ((GridDropDownGridListControlPart)cr.ListControlPart).Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo); private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if(e.ColIndex == 2) { e.Style.HorizontalAlignment = GridHorizontalAlignment.Right; } } DropDownSize: ------------- You can avoid the width of the dropdown getting larger by explicitly setting the width to some fixed value by handling the CurrentCellShowingDropDown. For example, setting it to the width to show all the columns. //at bottom of CurrentCellShowingDropDown..... int width = cr.ListControlPart.Grid.Model.ColWidths.GetTotal(0, cr.ListControlPart.Grid.Model.ColCount) + 16; e.Size = new Size( width, e.Size.Height); We have to address this issue. Best Regards, Jay N


AD Administrator Syncfusion Team September 24, 2004 10:24 PM UTC

thanks for the quick response! got it working perfect with some minor mods: private void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e) { GridControlBase grid = sender as GridControlBase; GridCurrentCell cc = grid.CurrentCell; GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.SetColHidden(1, 1, true); ((GridDropDownGridListControlPart)cr.ListControlPart).Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo); int width = cr.ListControlPart.Grid.Model.ColWidths.GetTotal(1, cr.ListControlPart.Grid.Model.ColCount - 1) + 100; e.Size = new Size(width, e.Size.Height); }

Loader.
Live Chat Icon For mobile
Up arrow icon