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

how to know the row of the GridView which contains the button I click

2 Answers 57 Views
GridView
This is a migrated thread and some comments may be shown as answers.
lina fetisova
Top achievements
Rank 1
lina fetisova asked on 19 Jul 2010, 03:37 AM
Good day!
You can click a button in one GridViewRow when enother GridViewRow is checked in my GridView. So tat's wrong to look which column is checked to know what button was clicked.
How can I know the GridViewRow which my clicked button belong to?

how my GridView looks:
http://i34.photobucket.com/albums/d126/durick/2-2.jpg

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 19 Jul 2010, 06:49 AM
Hi lina fetisova,

In the click event of the button just cast the sender to Button type and after that use our ParentOfType method to find the parent row of the button:

private void Button2_Click(object sender, RoutedEventArgs e)
{
    var button = sender as Button;
    // using Telerik.Windows.Controls
    var parentRow = button.ParentOfType<GridViewRow>();
    var parentItem = parentRow.Item;


Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
lina fetisova
Top achievements
Rank 1
answered on 19 Jul 2010, 09:52 AM
Milan, it works! Thank you very much!
Tags
GridView
Asked by
lina fetisova
Top achievements
Rank 1
Answers by
Milan
Telerik team
lina fetisova
Top achievements
Rank 1
Share this question
or