Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
grabbing the row that fired an event server side
posted

Frustratingly easy question but I have added a column with a button ( to do some behind the scenes processing) and have set it to fire an event server side.  I need to know what row's button fired the event?  I assumed the ActiveRow property would cover this but it is null when the event gets fired.  Is there an easy I'm have missed or should I be setting the ActiveRow manually client side?

Thanks,

Parents
No Data
Reply
  • 45049
    Verified Answer
    posted

    Assuming that you've used a column whose Type is set to Button, use the ClickCellButton event of the grid.  The value of e.Cell tells you the cell whose button was clicked.  From here, you can get the row (e.Cell.Row) or column (e.Cell.Column).

    If you've used a templated column, this becomes significantly more complicated.  Your idea of using client-side code to set the grid's ActiveRow when the button is clicked is the most straightforward solution that comes to mind.  You might instead look at the event you're already raising (such as the button's Click event or the grid's ItemCommand event), and look at the parent object of the button you clicked; somewhere in the object hierarchy you'll come up to a CellItem object that contains your button, whose Cell property is the grid cell containing that button.

Children
No Data