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

GridViewColumn with RadButton click event

1 Answer 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Harrigan
Top achievements
Rank 1
Richard Harrigan asked on 12 Jun 2011, 04:05 AM
Hi

I created a GridViewColumn which contains a RadButton.  See xaml below.  When the Click event is executed how do I get access to the row containing the button that was clicked.

Thanks
Rich

<telerik:GridViewColumn Header="">
                    <telerik:GridViewColumn.CellTemplate>
                    <DataTemplate>
                            <telerik:RadButton Click="FilterButton_Click"
                                               IsBackgroundVisible="False"
                                               ToolTipService.ToolTip="Search criteria"
                                               Margin="0">
                                <Image Source="Images2/Filter_16.png"
                                       Height="16"
                                       Width="16"></Image>
                            </telerik:RadButton>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>

1 Answer, 1 is accepted

Sort by
0
Richard Harrigan
Top achievements
Rank 1
answered on 12 Jun 2011, 06:43 PM
Hi,

Please ignore this request.  I solved my problem with the following code.

Thanks
Rich

private void Button_Click(object sender, RoutedEventArgs e)
       {
           QueryTableProperties queryTableProperties = 
               ((GridViewCell)((RadButton)e.OriginalSource).Parent).ParentRow.DataContext as QueryTableProperties;
           switch (((RadButton)e.OriginalSource).Name)
           {
               case "Filter":
                   break;
               case "Sort":
                   break;
               case "Group":
                   break;
               case "Expression":
                   break;
               case "Properties":
                   break;
           }
       }
Tags
GridView
Asked by
Richard Harrigan
Top achievements
Rank 1
Answers by
Richard Harrigan
Top achievements
Rank 1
Share this question
or