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
130
Problem adding UltraDropDown or UltraCombo in grid cell
posted

I've added an Unbound column to grid for adding combo control in it. I tried to add UltraDropDown/UltraCombo both through code and at design time but it doesn't show in grid. I tried both with EditorComponent and ValueList properties. Although it's not giving any error but it doesn't show up in grid.

If I replace this UltraCombo with check box it works perfect both at design and run time.

Parents Reply
  • 130
    posted in reply to Mike Saltzman

    Here is my code to add different type of controls in each row, it's working well except drop down/combo.

           

            private void Grid_InitializeRow(object sender, InitializeRowEventArgs e)
            {
                UltraGridRow row = e.Row;

    // Adding UltraDropDown to grid column but there's a problem, DropDown showing all columns as table instead of just DisplayMember as simple drop down

                UltraDropDown dpd = new UltraDropDown();
                dpd.DisplayMember = "Caption";
                dpd.ValueMember = "Operator";
                dpd.SetDataBinding(dtView, null, false, false);
                row.Cells[10].ValueList = dpd;

    // Adding UltraCombo to grid column but it's not populated with data and empty combo shown to grid column

                UltraComboEditor cmb = new UltraComboEditor();
                cmb.DisplayMember = "Caption";
                cmb.ValueMember = "Operator";
                cmb.DataSource = dtView;
                row.Cells[10].EditorComponent = cmb;


    // This code adds different type of controls in every row depending on value

                if (row.Cells[5].Text == "string")
                {
                    UltraTextEditor txt = new UltraTextEditor();
                    row.Cells[11].EditorComponent = txt;
                    row.Cells[12].EditorComponent = txt;

                }
                else if (row.Cells[5].Text == "date")
                {
                    UltraDateTimeEditor dt = new UltraDateTimeEditor();
                    row.Cells[11].EditorComponent = dt;
                    row.Cells[12].EditorComponent = dt;
                }
                else if (row.Cells[5].Text == "bool")
                {
                    UltraCheckEditor chk = new UltraCheckEditor();
                    row.Cells[11].EditorComponent = chk;
                    row.Cells[12].EditorComponent = chk;

                }
                else if (row.Cells[5].Text == "int")
                {
                    UltraNumericEditor num = new UltraNumericEditor();
                    num.MinValue = 1;
                    num.MaxValue = 100;
                    row.Cells[11].EditorComponent = num;
                    row.Cells[12].EditorComponent = num;
                }

         }

Children