Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
UltraComboEditor with checkBox in grid.
posted

Hi,

 

I have added a ComboEditor in a grid cell. I want to have multiple selections, so the CheckBoxStyle is CheckStyle.CheckBox.

 

I have created a DataTable with DataColumns in code and assigned to grid.DataSource.

(1) For the ComboEditor, what is the type of the DataColumn?

DataColumn dc = new DataColumn ("colName", typeof (???))';

(2) How can I access the check boxes when I create the grid? In the InitializeRow event of the grid, I create a ComboEditor and assign it to grid.EditorComponent, but when I fill the combeEditor items with ValueListItems with the CheckState = CheckState.Checked, none of the check boxes are checked. Only CheckState.Indeterminate will show a gray checked checkbox.

 

Regards and thanks.

 

 

 

Parents
No Data
Reply
  • 69832
    Offline posted

    1) typeof(object), typeof(string), or System.Array. For example, if you wanted to provide a front end for multiple integers, you could use typeof(int[]).

    2) The checkboxes are a representation of the cell's value. For example, if the column's data type was typeof(int[]), and you assigned int[]{ 1, 3, 5 } to the cell, the three items corresponding to those values would be would be checked

Children
  • 355
    posted in reply to Brian Fallon

    Hi Brian,

     

    Thanks for the quick reply. It is working, except when I checked some check boxes and I change the focus to another cell, I get the following message:

     

     

    I created the DataTable and DatColumns

    DataTable dt = new DataTable ("dtBeeps");

    dc = new DataColumn ("colLeftG1Speakers", typeof (string[]));

    dt.Columns.Add (dc);
    grdBeeps.DataSource = dt;
    I assign a string array to the cell.Value for the items which have to be checked.
    In the InitializeLayout event, I added the combo editor to the column.
    speakers is of type string[]
    if (cc["colLeftG1Speakers"].EditorComponent == null)
    {
        UltraComboEditor combo = new UltraComboEditor ();
        combo.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
        combo.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems;
        combo.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item;
        foreach (string item in speakers)
        {
            ValueListItem vli = new ValueListItem (item, item);
            combo.Items.Add (vli);
        }
        cc["colLeftG1Speakers"].EditorComponent = combo;
    }
    Do I have to extract the checked values of the combo boxes to a string array?
    Thanks again.