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

[Solved] Button in the grid

1 Answer 137 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shipra
Top achievements
Rank 1
Shipra asked on 17 Apr 2009, 04:46 PM
Hello,

In my grid, I have a button control as one of the columns. This button has text "X" and allows the user to delete the row, it is part of. However the problem is that in my onclick event for the button, the current item is set as null.

So, the question is how do I know which row this button was clicked on? Also, as nothing is selected at this point, the selected item property is also null. How do I retrieve row/record information based on this button click?

Thanks

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Apr 2009, 06:19 AM
Hello Shipra,

You can cast sender argument to Button and get parent grid row using our extension methods:

GridViewRow row = ((Button)sender).ParentOfType<GridViewRow>();

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Shipra
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or