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

How to get RadGrid controls on Drop Down (Combo) conrol's select changed event

3 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 2
Phil asked on 20 Feb 2009, 04:48 PM
Dim _comboBox As RadComboBox = TryCast(o, RadComboBox) 
    If _comboBox.SelectedIndex > -1 Then 
        Dim _dataItem As GridDataItem = CType(_comboBox.NamingContainer, GridDataItem) 
        _dataItem("Column2").Text = "Stuff" 
    End If 
End If 
 
The above updates a cell.  How do I find the control of Column2?

3 Answers, 1 is accepted

Sort by
0
Bruno
Top achievements
Rank 2
answered on 20 Feb 2009, 04:59 PM
Provide some details about your goal. This will ensure a better answer for your question.
0
Phil
Top achievements
Rank 2
answered on 20 Feb 2009, 09:47 PM
The Drop down has a value and text.  The text is a suggested description for the description GridBoundColumn.  So, I need to find the GridBoundColumn and place the SelectedValue in it.  This needs to be done in insert and edit forms of the grid control.
_dataItem("DescrColumn").Text = _comboBox.SelectedValue
0
Accepted
Princy
Top achievements
Rank 2
answered on 23 Feb 2009, 01:28 PM
Hello Phil,

The GridBoundColumn displays a TextBox when the grid is in EditMode. Try out the following code to access the TextBox control for the GridBoundColumn in the SelectedIndexChanged event of the RadComboBox:
cs:
     Protected Sub RadComboBox3_SelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) 
         Dim _comboBox As RadComboBox = DirectCast(o, RadComboBox) 
         Dim _editItem As GridEditableItem = DirectCast(_comboBox.NamingContainer, GridEditableItem) 
         Dim _textBox As TextBox = DirectCast(_editItem("FirstName").Controls(0), TextBox) 
         _textBox.Text = _comboBox.SelectedItem.Text 
     End Sub 

Thanks
Princy.
Tags
Grid
Asked by
Phil
Top achievements
Rank 2
Answers by
Bruno
Top achievements
Rank 2
Phil
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or