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

Setting drop down height for CellType=GridListControl

In a GridDataBoundGrid, while configuring the GridDataBoundColumns collection, a property for setting the height (number of rows) of the drop-down for a CellType of GridListControl, eludes me. Is there one? Many thanks to the Syncfusion team and the excellent support. --Kenton

2 Replies

AD Administrator Syncfusion Team May 27, 2004 05:32 AM UTC

You can set this on a grid-wide basis with code such as; GridDropDownGridListControlCellRenderer cr = (GridDropDownGridListControlCellRenderer) this.grid.CellRenderers["GridListControl"]; (( GridDropDownGridListControlPart) cr.ListControlPart).DropDownRows = 2; // 2 rows in the dropdown If you need to do it on a column by column basis (or cell by cell), then you will have to handle the CurrentCellShowingDropDown event.

private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
 GridControlBase grid = sender as GridControlBase;
 if(grid != null)
 {
  GridCurrentCell cc = grid.CurrentCell;
  GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
  if(cc != null)
  {
   if(cc.ColIndex == 6)
      ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 4;
   else if(cc.ColIndex == 4)
    ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 7;
   else if(cc.ColIndex == 2)
    ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 10;
   else
    ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 6;
  }
 }
}


KH Kenton Hensley May 27, 2004 10:40 AM UTC

Thank you Clay for the assistance. It is a small challenge for a newbie to figure out how and where everything is kept in such rich object modesl, especially for the grids where the object models vary. Two opportunities for improvement from my experience so far: First, to assist with evaluating and learning the grids a side by side comparison would greatly aid in differentiation. I found this quite time consuming. Second, in the definition of events, the documentation tends to discuss the events in terms of themselves (a defnintion without synonyms is not very helpful). I''ve found it difficult to figure out exactly what the events do or which is appropriate. More examples in the event documentation itself would be very helpful. I''m sure you have many great ideas you would like to implement given cash and time, but these struck me right away as early hurdles. Since first impressions are so important it might be a good place to spend some effort. Thank you to you and the SyncFusion team, I enjoy using the product and the results are pleasing. --Kenton

Loader.
Live Chat Icon For mobile
Up arrow icon