This is a migrated thread and some comments may be shown as answers.

Multicolumn combo box column Selected item

4 Answers 798 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Carol Watson
Top achievements
Rank 1
Carol Watson asked on 05 Mar 2010, 04:30 PM
Hi.  I am using your Q3 2009 WIn controls and would like to know how do I trap the selected item change event in a multi column combo box column in the grid view.

Additionally, I am trying to format the Drop down (grid element) of the column in a subroutine. 
The grid itself is bound to a list and the  multi-column combo box column is bound to another list.  I am able to bound the dropdown list using;

Dim colLookup As GridViewMultiComboBoxColumn = TryCast(.Columns("SourceColumnIndex"), GridViewMultiComboBoxColumn)

            If colLookup IsNot Nothing Then
                colLookup.DataSource = SourceColumPicLst
                colLookup.ValueMember = "ColumnIndex"
                colLookup.DisplayMember = "ColumnIndex"
            End If

That successfully binds and displays the list for the columns properly.
I would also like to format the dropdown displayed.  I've attempted to access the editor control using the GetDefaultEditor() function of the Column setting that to a grid view.   It however returns nothing.  What event could I use to get to the grid element of the dropdown that will allow me to format the display?

Thank you for the assist.

4 Answers, 1 is accepted

Sort by
0
Carol Watson
Top achievements
Rank 1
answered on 05 Mar 2010, 10:26 PM
Since I have posted, I have tried to Use this code to trap the Selected Value Changed for the multicolumn combo box column on the grid

Private Sub grdColumnMappings_EditorRequired(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.EditorRequiredEventArgs) Handles grdColumnMappings.EditorRequired


        If e.EditorType Is GetType(RadMultiColumnComboBoxElement) Then
            AddHandler DirectCast(e.Editor, RadMultiColumnComboBoxElement).SelectedValueChanged, AddressOf Editor_ValueChanged
        End If


    End Sub

Private Sub Editor_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)

        If grdColumnMappings.CurrentCell.ColumnIndex = grdColumnMappings.Columns("SourceColumnIndex").Index Then

            Dim IntValue As Integer = DirectCast(grdColumnMappings.ActiveEditor, RadMultiColumnComboBoxElement).SelectedValue
            Dim strText As String = DirectCast(DirectCast(grdColumnMappings.ActiveEditor, RadMultiColumnComboBoxElement).SelectedItem, RadMultiColumnComboBoxElement).Text

            grdColumnMappings.CurrentRow.Cells("SourceColumn").Value = strText

        End If
    End Sub
I've used the code as suggested in this thread:
http://www.telerik.com/community/forums/winforms/gridview/populate-combobox-in-radgrid-at-runtime.aspx

When I run the app it stops at the line that attempts to add the handler with an error describing the E.editor is nothing

Is there another event I can Use or is there another method of accomplishing this task
Thank you









0
Martin Vasilev
Telerik team
answered on 10 Mar 2010, 05:22 PM
Hello Carol Watson,

Thank you for writing. You must use CellEditorInitialized event to get access to MultiColumnCombo editor. Once you get it, you can subscribe to SelectedIndexChanged event and set various properties. Please, consider the following code:

Private Sub radGridView1_CellEditorInitialized(ByVal sender As Object, ByVal e As GridViewCellEventArgs)
    Dim element As RadMultiColumnComboBoxElement = TryCast(Me.radGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
    If e.ColumnIndex = 5 AndAlso element IsNot Nothing Then
        element.EditorControl.Columns(0).Width = 120
        AddHandler element.SelectedIndexChanged, AddressOf element_SelectedIndexChanged
    End If
End Sub

Let me know if you have any additional questions.

Greetings,
Martin Vasilev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Mr
Top achievements
Rank 1
answered on 04 Feb 2014, 05:16 PM
And how to give the values ​​for the fields after selection؟؟
0
Dimitar
Telerik team
answered on 06 Feb 2014, 04:28 PM
Hello,

Thank you for writing.

I do not understand your question and also I cannot see any relation to this thread. This is why I want to kindly ask you to specify your goals with this case one more time. 

Also information about the GridViewMultiComboBoxColumn is available in the following topic: GridViewMultiComboBoxColumn.

I am looking forward to your reply.

Regards,
Dimitar
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Tags
GridView
Asked by
Carol Watson
Top achievements
Rank 1
Answers by
Carol Watson
Top achievements
Rank 1
Martin Vasilev
Telerik team
Mr
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or