This question is locked. New answers and comments are not allowed.
I have a TextBlock inside RadGridView>RowDetailsTemplate>RadTabControl>RadTabItem>Grid and a RadButton inside the same RadGridViewRowDetailsTemplate>RadTabControl>RadTabItem. When the user clicks on the button the data in the TextBlock must be stored in a DataBase.
The problem is, how can I access to the text in the TextBlock from the code behind associated to the "ClickEvent"? (The TextBox isn't visible in the code behind)
I have tried to obtain it with RowDetailsTemplate.FindChildByType<TextBox>() but this returns NULL
Also with radGridViewBaseTarification.FindName("CommentairePrix") with the same result.
The function var myTextBlock = radGridViewBaseTarification.FindChildByType<TextBox>(); doesn't return me the correct TextBox, but the last one edited by the user.
Thanks for your help
Here you can find an extract of the xaml structure of my view and the associated event code behind .
The problem is, how can I access to the text in the TextBlock from the code behind associated to the "ClickEvent"? (The TextBox isn't visible in the code behind)
I have tried to obtain it with RowDetailsTemplate.FindChildByType<TextBox>() but this returns NULL
Also with radGridViewBaseTarification.FindName("CommentairePrix") with the same result.
The function var myTextBlock = radGridViewBaseTarification.FindChildByType<TextBox>(); doesn't return me the correct TextBox, but the last one edited by the user.
Thanks for your help
Here you can find an extract of the xaml structure of my view and the associated event code behind .
<views:PricingRadGridView x:Name="radGridViewBaseTarification" Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="False" RowEditEnded="radGridViewBaseTarification_RowEditEnded" RowValidating="radGridViewBaseTarification_RowValidating"><br><views:PricingRadGridView.RowDetailsTemplate ><br> <DataTemplate x:Name="GridRowDetailsTemplate"><br> <Grid x:Name="GridRowDetailsTemplate"><br> <Grid.RowDefinitions><br> <RowDefinition Height="Auto"/><br><RowDefinition Height="Auto" /><br> </Grid.RowDefinitions><br> <Grid.ColumnDefinitions><br> <ColumnDefinition Width="Auto" /><br> </Grid.ColumnDefinitions><br> <telerikNavigation:RadTabControl Grid.Row="0" BackgroundVisibility="Collapsed" Width="Auto"<br> x:Name="RadTabControl1" Margin="35,10,0,10" VerticalAlignment="Center" Background="Transparent"><br><br> <telerikNavigation:RadTabItem x:Name="PrixBase" Header="Prix de base" Margin="160, 0, 5, 0" Width="Auto"<br><br> <Grid x:Name="GridPrixBase"><br> <Grid Grid.Column="1" Grid.Row="0" x:Name="CommentairesPrix" Margin="5,0,5,0" ><br> <Grid.RowDefinitions><br> <RowDefinition Height="Auto"/><br> <RowDefinition Height="Auto"/><br></Grid.RowDefinitions><br> <TextBlock Grid.Row="0" Margin="5,5,5,5"><br>Commentaires<br> </TextBlock><br> <TextBox Grid.Row="1" Height="75" Width="300" Text="{Binding CommentairePrix}" Margin="5,10,5,10" x:Name="CommentairePrix" /><br></Grid><br><telerik:RadButton Grid.Row="1" Grid.Column="1" x:Name="btnModifierCommentairePrix" Content="Modifier le commentaire" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20,5,20,5" Padding="6,6,6,6" Style="{StaticResource RadButtonStyle}" Click="btnModifierCommentaire_Click"/><br>[...]<br> </Grid><br> </Grid><br> </telerikNavigation:RadTabItem><br> </telerikNavigation:RadTabControl><br> [....] <!-- second row in the Grid--><br></Grid><br> </DataTemplate><br></views:PricingRadGridView.RowDetailsTemplate><br>[...] <!-- Columns Definition--><br></views:PricingRadGridView ><br><br> private void btnModifierCommentaire_Click(object sender, RoutedEventArgs e)<br> {<br> RadButton myClickedButton = (RadButton)sender; <br> /*Code to access to the data in the textBox to store in the dataBase*/ <br> }