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
135
How to set EditorControl programmatically?
posted

Hello,

I have an UltraWinGrid whose datasource is set to a BindingList object. For instance,

this.gridCar.DataSource = this.listCars;

 

Now, I need one of the columns to be a UltraComboEditor control. So, I'm writing this:

this.gridCar.DisplayLayout.Bands[0].Columns[0].EditorControl = this.comboBrands;

 

But... when I run the application, no combo is shown.

I have already tried to set the Style property to DropDownList style, but nothing works.

It seems the column does not accept any kind of embedded editor.

 

Is there anything wrong with my code?

Could you give me a clue why is this not working?

Thank you in advance.

 

Best Regards,

  Pedro Rosas

  • 469350
    Suggested Answer
    Offline posted

    Hi Pedro,

    My first question is, what exactly are you trying to accomplish by assigning an UltraCombo to the column? If you just want a dropdown list in a column, there are better ways to do it than using an UltraCombo. UltraCombo is probably the least efficient way. Here's a link with more info.

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

    Regarding why it's not working, Matt's point is a valid one. You should probably refer to the column by it's Key rather than Index.The Index of a column may change, but the Key will not.

    Another possiiblity is that the column in question is not editable. You cannot have a dropdown list in a column that is read-only or disabled. Are you able to type into the column?

     

  • 37774
    Suggested Answer
    posted

    Pedro,

    Are you certain that the first column in the Columns collection is the correct column to assign the EditorControl to?  The order might not, for whatever reason, be the same as the columns that are shown in the grid; you may want to try indexing into the Columns collection by key.

    -Matt