Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Ultragrid column not displaying as drop down

Ultragrid column not displaying as drop down

New Discussion
Mike Cheel
Mike Cheel asked on Mar 26, 2019 1:40 PM

I have 2 grids on two separate forms. Both are bound to the same type. I have a helper method that configures a column to be a drop down.

It works in one grid and not the other.

The column in the grid where it is not working is clearly binding to the data in the data source because the values are correct. It is just not showing as a drop down.

If I add an unbound column to the grid and configure it as a drop down the code works (see below):

const string TEST_VALUE = "DropdownTest";
ValueList vl = null;
if(!Grid.DisplayLayout.ValueLists.Exists(TEST_VALUE))
{
	vl = Grid.DisplayLayout.ValueLists.Add(TEST_VALUE);
	vl.ValueListItems.Add("Red");
	vl.ValueListItems.Add("Green");
	vl.ValueListItems.Add("Blue");
}

if(!columns.Exists(TEST_VALUE))
{
	UltraGridColumn dropdown = columns.Add(TEST_VALUE);
	dropdown.ValueList = vl;
	dropdown.CellActivation = Activation.AllowEdit;
	dropdown.CellClickAction = CellClickAction.Edit;
	dropdown.Style = ColumnStyle.DropDownList;
	dropdown.Header.Caption = "Lol whut?";
}

What could possibly be interfering with displaying the drop down for this column? I feel like I have checked everything…

Sign In to post a reply

Replies

  • 0
    Michael Peterson
    Michael Peterson answered on Mar 25, 2019 6:58 PM
    Hello Mike,
    Thank you for contacting Infragistics!
    The best way for us to assist you is if you provide a small isolated sample that we can run and use for debugging locally. If you are unable able to provide an isolated sample I may be able to give suggestions if you provide the code for your page.
  • 0
    Mike Saltzman
    Mike Saltzman answered on Mar 25, 2019 8:43 PM

    Is the column editable? Can you type into it? The cell will not drop down unless editing is enabled, so if you have disabled editing (or your data source does not allow editing that particular field), it will not drop down. 

    Does the DropDown button display in the cells and just not work? Or does it not show up at all? 

    • 0
      Mike Cheel
      Mike Cheel answered on Mar 26, 2019 12:25 PM

      Thanks for your reply Mike. It turns out the list I was using for the data source was derived from CSLA ReadOnlyListBase. Calling ToList() on the read one makes the drop down appear. The objects in the list are editable and the same that were there in the 'read only' version however. What constitutes a read only list to the UltraGrid?

      • 0
        Mike Saltzman
        Mike Saltzman answered on Mar 26, 2019 1:09 PM

        Well, just to be clear, it's not the dropdown list that needs to be editable, it's the cells in the grid. If are you able to enter edit mode on the grid cell and type into it to change the value, then it's editable. If you can't, then it's not editable and the dropdown cannot be displayed.

        You can, of course, disable editing for the grid, column, row, or cell using various properties on the grid. But assuming you are not doing that, then the field in the data source can be ReadOnly, as well. 

        I'm not familiar with CSLA ReadOnlyListBase, but if you are using that as your grid's DataSource and it doesn't allow editing of the data, then the grid obviously can't edit the data, either. And therefore, the grid won't be able to show a dropdown. So if you need users to be able to drop down a list or edit the cells in the grid, you have to use a DataSource that allows editing. 

        BTW… I assume ToList() return a List or List<T> and that's generally not a great data source to use for a grid. List<T> doesn't send notifications for things like adding or deleting rows. So it's better to use a BindingList<T> or something that implements IBindingList. 

      • 0
        Mike Cheel
        Mike Cheel answered on Mar 26, 2019 1:35 PM

        CSLA's ReadOnlyListBase and the List<T> I converted it to both had the same objects in it. I am wondering what criteria Infragistics components (like the grid here) look for to determine whether a data source is read only or not. Is there some standard interface or something?

      • 0
        Mike Saltzman
        Mike Saltzman answered on Mar 26, 2019 1:40 PM

        The details are a little tricky. It's not really the grid or the bound control that determines this – it's the BindingManager in DotNet. Basically when you bind a control, the grid and other bound controls ask the BindingManager for the data structure. It returns a list of PropertyDescriptors and each PropertyDescriptor has a property that determines if the property is settable. 

        From your perspective, it's usually some property on the data source field that the BindingManager then translates to the property descriptor. For example, if you bind to a DataSet/DataTable, the DataColumn object has a ReadOnly property. Presumably, the fields in the ReadOnlyListBase have the same or similar property on each field. Or since the class it'self is named ReadOnlyListBase, maybe it just always returns property descriptors that are ReadOnly and there is no property. 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Mike Cheel
Favorites
0
Replies
6
Created On
Mar 26, 2019
Last Post
7 years ago

Suggested Discussions

Created by

Created on

Mar 26, 2019 1:40 PM

Last activity on

Feb 24, 2026 2:19 PM