Home Forums WinForms controls Xceed Grid for WinForms Grid 3.0 Editors question

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #14334 |

    I am working with an unbound grid that I am trying to use a databound DropDownList by using the ComboBoxEditor and ComboBoxViewer controls. I have all the columns added to the grid, the ComboBox is populated from the database, but the issue is I need to set the value of the ComboBox when the grid is populated. Here’s how I’m building it:
    // columns for first grid
    Xceed.Grid.Column colCompId = new Xceed.Grid.Column(“COMP_ID”, typeof(long));
    colCompId.Width = 64;
    colCompId.ReadOnly = true;
    Xceed.Grid.Column colLibId = new Xceed.Grid.Column(“LIB_ID”, typeof(long));
    colLibId.Width = 56;
    colLibId.ReadOnly = true;
    Xceed.Grid.Column colLibraryName = new Xceed.Grid.Column(“LIBRARY_NAME”, typeof(string));
    colLibraryName.Width = 160;
    colLibraryName.ReadOnly = true;
    Xceed.Grid.Column colReportedName = new Xceed.Grid.Column(“REPORTED_NAME”, typeof(string));
    colReportedName.Width = 160;
    colReportedName.ReadOnly = true;
    Xceed.Grid.Column colStatus = new Xceed.Grid.Column(“STATUS”, typeof(string));
    colStatus.Width = 60;

    // add columns to grid

    // fill the dataset with the status values from the db
    myDS = GetStatusValues();

    // editor
    cboStatusEd = new ComboBoxEditor();
    cboStatusEd.DataSource = myDS;
    cboStatusEd.DataMember = “Table”;
    gcChroSet.Columns[“STATUS”].CellEditorManager = cboStatusEd;

    // viewer
    cboStatusVw = new ComboBoxViewer(myDS, “Table”, “name”);
    gcChroSet.Columns[“STATUS”].CellViewerManager = cboStatusVw;

    // now when i populate the grid from another method, I’m looping through the data and loading the grid values

    foreach (System.Data.DataRow myRow in myTable.Rows)
    // add items to gcChroSet
    Xceed.Grid.DataRow row = gcChroSet.DataRows.AddNew();
    row.Cells[“COMP_ID”].Value = (long)Convert.ToInt64(myRow[“COMP_ID”].ToString());
    row.Cells[“LIB_ID”].Value = (long)Convert.ToInt64(myRow[“LIB_ID”].ToString());
    row.Cells[“LIBRARY_NAME”].Value = myRow[“LIBRARY_NAME”].ToString();
    row.Cells[“REPORTED_NAME”].Value = myRow[“REPORTED_NAME”].ToString();
    row.Cells[“STATUS”].Value = myRow[“STATUS”].ToString();

    This is working as far as loading the grid with the correct values, but I have to click in a Status Cell in order to see the value in the ComboBox. Is there anything I can do so that they are all showing their values without making the user click the cell to see the status value?

    Thank you

    Imported from legacy forums. Posted by Nathan (had 2247 views)

    User (Old forums)
    Post count: 23064

    I solved the problem by setting CellEditorDisplayConditions to Always. Hopefully this will help someone else.

    Imported from legacy forums. Posted by Nathan (had 2994 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.