Combobox in Ultragrid

This post has 8 Replies | 4 Followers

cirej
Points 110
Replied On: Tue, Feb 12 2008 2:10 AM

How can i add collection of values in my combobox ultragrid.

And is it possible to add a radio button in my ultragrid?

Please help. Thanks.

  • Post Points: 35
Mike Saltzman
Points 448,905
Infragistics Employee
Replied On: Tue, Feb 12 2008 10:39 AM

This KB article should help with the dropdown list:

 HOWTO:What is the best way to place a DropDown list in a grid cell?

To place radio buttons in a cell, you can set the column's EditorControl property to an UltraOptionSet control. But this will place multiple options into a single cell, which probably isn't what you want. If you mean you want a radio button that only allows one grid row to be "selected" at a time, then the grid doesn't have this functionality build it. So what you could so is use an UltraOptionSet with one option, then manually de-select the last row when the user selects a new one.  

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 44
Toji Mathew
Points 485
Replied On: Wed, Oct 2 2013 6:06 PM

In the specified link i see a portion like this:

DropDownStyle
By default, when a ValueList is attached to a grid column, the user may choose an item from the list or may type into the cell. The grid will attempt to find the closest matching item on the list and fill in the cell (AutoComplete). If no match is found, the user may enter text that does not exist on the list. To prevent this, set the DropDownStyle property of the grid column to DropDownList. This will prevent the user from typing into the cell, although the keyboard will still function for searching through the list.


How to set the dropdownstyle propety of the grid column to dropdownlist? I didn't see an option like this on the grid column.

I wanted to disable typing in the dropdown in the ultragrid.


Thank you,

  • Post Points: 20
Mike Saltzman
Points 448,905
Infragistics Employee
Replied On: Thu, Oct 3 2013 9:32 AM


        private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand band = layout.Bands[0];

            band.Columns["My ValueList Column"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
        }

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
Toji Mathew
Points 485
Replied On: Thu, Oct 3 2013 10:57 AM

This worked. Thank you.

  • Post Points: 5
Replied On: Tue, Apr 21 2015 1:12 PM

Hi , i would like to add a windows combobox to ultragrid cell instead of ultradropdown? any ideas on this ?

  • Post Points: 20
Mike Saltzman
Points 448,905
Infragistics Employee
Replied On: Wed, Apr 22 2015 10:02 AM

Hi Prasaanth,

You might be able to do this using the UltraControlContainerEditor, but that's a pretty complicated solution. Why can't you use a ValueList, UltraDropDown, or UltraComboEditor?

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
Replied On: Wed, Apr 22 2015 2:27 PM

Hi Mike ,

I am currently using UltraDropDown . But it is such that I am forced to add a datatable to it . And hence it keeps whoing the title of the column of the table when I click the drop down. 

Another thing is , the option selected in the Dropdown should be displayed  , but it should not be editable . 

something like WindowsComboBox.DropDownStyle =DropDownList (which ensures that the options selected are displayed but user cannot type in an option of his own .

If you could point out some solution to these two things using UltraDropDown , that would be very helpful sir,

Regards,

Prasaanth 

  • Post Points: 20
Mike Saltzman
Points 448,905
Infragistics Employee
Replied On: Wed, Apr 22 2015 2:57 PM

Hi Prasaanth ,

If you don't want the columns and the header to show, the easiest thing to do is to use a ValueList. The ValueList does not need to be data bound, either, so you can populate the list manually.

Using DropDownList style is just a matter of setting the Style property on the grid column to DropDownList. You can do that with UltraDropDown or a ValueList and it will work with either one. I posted sample code this earlier in this thread.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 5
Page 1 of 1 (9 items) | RSS