Dropdown Combo in FlexGrid on click

Posted by: spaceage15 on 18 July 2018, 12:10 pm EST

    • Post Options:
    • Link

    Posted 18 July 2018, 12:10 pm EST - Updated 3 October 2022, 5:27 pm EST

    Hello,

    As the title suggests, how can I set the droppeddown value to true if my combo list is in one of the flexgrid rows.

    I loaded the list this way:

    Now I want to set the dropdown value of this column whenever that specific row is selected.

    Thanks in advance.

    Edson

  • Posted 18 July 2018, 4:00 pm EST

    Hi,

    You can get the ComboBox Editor after edit mode is started on the ComboList column using this code:

    private void _flex_RowColChange(object sender, EventArgs e)
    {
         if (_flex.Cols[_flex.Col].ComboList != string.Empty)
         {
               _flex.StartEditing();
               dynamic comboBox = _flex.Editor;
               comboBox.DroppedDown = true;
          }
    }
    

    You would need to add this method as RowColChange event handler.

    Please also find the attached sample for this.

    Thanks.

    ComboDropDownOnSelection.zip

  • Posted 23 July 2018, 11:24 am EST - Updated 3 October 2022, 5:27 pm EST

    I have a few concerns:

    1. So what exactly is that dynamic class that you used? I don’t have that in my build of ComponentOne. I should have mentioned that I am using v2.0.50727.

    2)The other thing is that I am actually loading my combolists dynamically. And on click of a row I want to automatically drop down the list (whether the user clicks the first or second column, we want the combo list for that row to drop). Here are some snippets of how I’m performing this.

    1. So I managed to get the combo to drop with the _flex.StartEditing() line. But its affecting the selection styles that I have set. And Again, I cant use the dynamic class because it doesn’t exists in my build. I had to comment that line

    How would you recommend solving this problem?

  • Posted 23 July 2018, 6:24 pm EST

    Hi,

    Thanks for your code snippets.

    1. The dynamic keyword is used to define a variable whose Type will be resolved at runtime. It was added in .NET 4.

      Since you are using .NET2.0 and VB, you can instead use reflection instead of dynamic.

    2. I’ve modified the sample so that the ComboBox is activated when a row is clicked. Please find the attached sample.

    3. Can you please explain the problem of selection styles? You can modify the attached sample so I can see your problem.

    Also, if you want the ComboBox to be activated on clicking a row other cells would never go into Edit mode. Is this your requirement? Or do you want your users to first select an item from dropdown and then edit other cells in that row?

    Regards

    Jitender

    ComboDropDownOnSelectionVB.zip

  • Posted 24 July 2018, 11:07 am EST

    Hi Jitender,

    Thanks for that example. I managed to solve my problem with your help. Below is an example of how I did it for anyone else who comes across this thread.

    Also in response to your post:

    1. Since I didnt have the dynamic class, I used the object type class so that compiles and runs fine.
    2. I used what you gave me and modified it for my needs.
    3. The problem with the styles was a mistake in my code. My example is how I did it.

    I appreciate the help

    Best Regards

    Edson

    ComboDropDownOnSelectionVB_myfix.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels