7 Answers, 1 is accepted
You may take a look at this forum thread for a reference considering the way for handling the value changes and this forum thread for the way to get the row index.
Kind regards,
Maya
the Telerik team

<Grid.Resources>
<Style TargetType=
"telerik:RadComboBox"
>
<EventSetter Event=
"SelectionChanged"
Handler=
"ComboBox_SelectionChanged"
/>
</Style>
</Grid.Resources>
<
Grid.Resources
>
<
Style
TargetType
=
"telerik:RadComboBox"
>
<
EventSetter
Event
=
"SelectionChanged"
Handler
=
"ComboBox_SelectionChanged"
/>
</
Style
>
</
Grid.Resources
>
<
Grid.Resources
>
<
Style
TargetType
=
"telerik:RadComboBox"
>
<
EventSetter
Event
=
"SelectionChanged"
Handler
=
"ComboBox_SelectionChanged"
/>
</
Style
>
</
Grid.Resources
>
Here my code for setting up the combobox column, how can I add an event handler to get the row index when the value is changed?
private
GridViewComboBoxColumn assignUserCol =
new
GridViewComboBoxColumn();
assignUserCol.DataMemberBinding =
new
System.Windows.Data.Binding(
"Assigned"
);
TextBlock assignedTb =
new
TextBlock();
assignedTb.Text =
"Assign User"
;
ToolTipService.SetToolTip(assignedTb,
"Assign a User"
);
assignUserCol.Header = assignedTb;
assignUserCol.UniqueName =
"Assign User"
;
assignUserCol.SelectedValueMemberPath =
"UserId"
assignUserCol.DisplayMemberPath =
"UserName"
;
Unfortunately, the EventSetter is not available in Silverlight. You may take a look at this forum thread for a reference. Another approach for subscribing to SelectionChanged event is demonstrated in this blog post (point 3). So, once you add the handler:
this.RadGridView1.AddHandler(RadComboBox.SelectionChangedEvent, new Telerik.Windows.Controls.SelectionChangedEventHandler(comboSelectionChanged), true);
You may get the row index as follows:
private void comboSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
var row = (e.Source as RadComboBox).ParentOfType<
GridViewRow
>();
var index = this.RadGridView1.ItemContainerGenerator.IndexFromContainer(row);
}
Regards,
Maya
the Telerik team

The combo box column is bound to a webserivce call which returns a result of possible users. I do see the combo box column populated with the correct values.
If I understand you correctly, once you change the value for the GridViewComboBoxColumn, it turns out to be null and nothing is displayed as selected item in the ComboBox. Do you do anything specific in the SelectionChanged handler or you are using just the code-snippet above ? Any additional relevant information would be helpful.
Maya
the Telerik team

You can see from my previous code that the displayMember property is tied to the Username of the salesperson object and the displayvalue is the guid from that object.
I have code to populate the main grid from the customer table and code to populate the combo box from the sales table. There is a property of the customer object that holds the guid to the sales object to show the assignment.
Most probably the reason for this behavior is not correct settings of bindings. I am sending you a sample project illustrating the implementation of a GridViewComboBoxColumn. You may use it as a reference and change it in the way you want. Furthermore, in case that does not help, I would need more information about your Business Object, its exposed properties and the settings of the grid.
Maya
the Telerik team