FlexGrid for WinForms
ComboList Property (C1FlexGridBase)
Example 



Gets or sets the list of items to be used by the drop-down editor.
Syntax
'Declaration
 
<C1DescriptionAttribute("Gets or sets the list of items to be used by the drop-down editor.")>
<BrowsableAttribute(False)>
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>
Public Property ComboList As String
'Usage
 
Dim instance As C1FlexGridBase
Dim value As String
 
instance.ComboList = value
 
value = instance.ComboList
[C1Description("Gets or sets the list of items to be used by the drop-down editor.")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string ComboList {get; set;}
[C1Description("Gets or sets the list of items to be used by the drop-down editor.")]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public:
property String^ ComboList {
   String^ get();
   void set (    String^ value);
}
Remarks

The ComboList property specifies the type of editor to be used when editing a cell. You may use a text box, drop-down list, drop-down combo, or an edit button to pop up custom editor forms.

To use the ComboList property, set the AllowEditing property to true and respond to the BeforeEdit event by setting the ComboList property to a string that describes the type of editing you want to use for that cell. The options are described below:

1. To edit the cell using a regular text box, set the ComboList property to an empty string. For example:

flex.ComboList = string.Empty;

2. To edit the cell using a drop-down list, set the ComboList property to a string containing the available options, separated by pipe characters. For example:

flex.ComboList = "Item 1|Item 2|Item 3";

3. To edit the cell using a drop-down combo, set the ComboList property to a string containing the available options, separated by pipe characters ("|") and starting with a pipe character. For example:

flex.ComboList = "|Item 1|Item 2|Item 3";

4. To display an edit button, set the ComboList property to a string containing an ellipsis ("..."). Edit buttons look like regular push buttons, aligned to the right of the cell, with an ellipsis as a caption. When the user clicks on the edit button, the grid fires the CellButtonClick event. In this case, the user can't edit the cell contents directly. For example:

flex.ComboList = "...";

5. To display an edit button next to an editable cell, set the ComboList property to a string containing a pipe and an ellipsis ("|..."). In this case, you get a regular edit button but the user can also edit the cell contents directly. For example:

flex.ComboList = "|...";

The ComboList property is especially useful in cases where different rows in the same column may contain different types of data (for example a control such as the PropertyGrid). In this case, the ComboList property allows you to adjust the type of editing you want to provide depending on the current row.

If all rows in the column contain the same type of data, use the Column's RowCol.ComboList property instead. This way, the grid will automatically select the list depending on the column being edited and you don't need to handle any events.

Note that the ComboList allows you to specify lists of strings only. Cells will store and display these strings. If you want to store a certain type of data and display values associated with that data, see the RowCol.DataMap property. The DataMap property allows you to store values in the cells (for example a CustomerID) and display strings associated with that data (for example the customer name).

Example
The code below handles the BeforeEdit event and assigns a value to the ComboList property so that the grid displays buttons on every other row.
void _flex_BeforeEdit(object sender, RowColEventArgs e)
{
  _flex.ComboList = string.Empty;
  if (e.Row % 2 == 0) _flex.ComboList = "...";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

C1FlexGridBase Class
C1FlexGridBase Members

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Send Feedback