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

How to access a control inside a radgridview ?

1 Answer 79 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 17 Jul 2013, 02:58 PM
Hi,

I have the following Radgridview GridViewColumn :

<telerik:GridViewColumn x:Name="ExamesSolicitados" Header="Exames Solicitados" HeaderTextAlignment="Center">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <Controls:TextBlock x:Name="CodSalaAtendimentoEventosAtendimento" Text="{Binding CodSalaAtendimento}" Visibility="Collapsed" />
                                <userControls:EventosAtendimento x:Name="eventosUrgencia" ></userControls:EventosAtendimento>
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>


I need to get the "CodSalaAtendimentoEventosAtendimento" and the "eventosUrgencia" ?
How can i access both controls and get e.g. the Textblock's value ?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 18 Jul 2013, 12:08 PM
Hi,

In order to get the TextBlock's value, I would suggest you to rely on the binding, i.e. to use the value of the "CodSalaAtendimento" property.

Otherwise, you could get any element of the GridView with the ChildrenOfType extension method.
For example:

var allTextBlocks = this.clubsGrid.ChildrenOfType<TextBlock>().Where(x => x.Name == "CodSalaAtendimentoEventosAtendimento");

The same can be done on a row's level and find a TextBlock/Control on a single row.
Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or