Edit this page

Find a control in RowDetailsTemplate

This article demonstrates how to find a control which is placed in the DataTemplate of the RowDetailsTemplate.

Let assume that you have a control (RadComboBox) in the RowDetailsTemplate which you need to set some properties at runtime:

            <telerik:RadComboBox Name="rcbCountries" />
            <!-- some other controls here -->

The best way to do this is to subscribe to the LoadingRowDetails event and find the control there:

<telerik:RadGridView Name="gridView" 
ItemsSource="{Binding Source={StaticResource itemsList}}"

In the LoadingRowDetails event handler use the FindName method of the e.DetailsElement:

private void gridView_LoadingRowDetails(object sender, GridViewRowDetailsEventArgs e)
    RadComboBox countries = e.DetailsElement.FindName("rcbCountries") as RadComboBox;
    countries.ItemsSource = GetCountries();
Private Sub gridView_LoadingRowDetails(sender As Object, e As GridViewRowDetailsEventArgs)
    Dim countries As RadComboBox = TryCast(e.DetailsElement.FindName("rcbCountries"), RadComboBox)
    countries.ItemsSource = GetCountries()
End Sub

See Also

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article