I am building a grid dynamically and putting buttons in one of the columns. When I click a button, I want to know what row of my grid it's in. How can I find this?


In the Click event handler for the button you say:

int row;
Button btn = sender as Button;
if (btn != null)
    row = Grid.GetRow(btn); // And you have the row number...
    // A nasty error occurred...

Your Answer

