ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2016-04-02 07:00:22

asparatu
Member
Registered: 2014-08-20
Posts: 196

DropDownlist Question

Hello Jing,
Why does the dropdownlist seletecteditemchanged event not fire when you set the value directly? I set the code like your example: "sheet["B2"] = "Apple";." When i first setup the ddl, i set to first item in the list and when it changes, i have update a class with the index value and dispalytext, but i notice, when set like you said, it does not fire the event, so it never update the class. When you change the in the sheet it will fire and update the class.

Shane

This form the worksheet setup

           'Initializes  a new instance of the ddl control and sets the default values
            ddlGYWSBetterIf = New SigmaAid.Controls.DropdownListCell(My.Resources.strLowerTitle, My.Resources.strHigherTitle,
                                                         My.Resources.strCloseToTarget)

            'set the SelectedItemsChanged event handle to the control
            AddHandler ddlGYWSBetterIf.SelectedItemChanged, AddressOf ddlGYWSBetterIf_SelectedItemChanged

            'Sets the default setting for the control
            With ddlGYWSBetterIf
                .DropdownPanelHeight = 50
            End With

            'Sets the ddl control to the cell
            rgGreenYSheet("B4") = ddlGYWSBetterIf

            'Sets the default Value
            rgGreenYSheet("B4") = My.Resources.strHigherTitle

The Event code

  Private Sub ddlGYWSBetterIf_SelectedItemChanged(sender As Object, e As EventArgs)
        Dim ddl As SigmaAid.Controls.DropdownListCell = DirectCast(sender, SigmaAid.Controls.DropdownListCell)

        'Checks to see if the index has changed
        If Not ddl.SelectedIndex.Equals(ProjectInfo.BetterIfIndex) Then
            With ProjectInfo
                .BetterIfIndex = ddl.SelectedIndex
                .BetterIfText = ddl.Cell.DisplayText
            End With
        End If
    End Sub

Offline

#2 2016-04-03 01:08:10

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: DropDownlist Question

Hi Shane, I think it's better to use CellDataChanged instead of SelectedItemChanged. Cell and Drop-down list are two separated objects, Drop-down list updates cell's data when selected item changed, but cell doesn't update its value to drop-down list, since the value may doesn't exist in the drop-down's candidates list.

Offline

Board footer

Powered by FluxBB