Selecting a row when clicking a command button in DataGrid #2943
-
Should clicking a button in the command column on a row select the row in the DataGrid? I'm having an issue on 1 case when I click the edit button without selecting a row. If I first select the row, then clicking the edit button the error does not occur. Is there a workaround I can do with the Clicked event on the button in the ? I haven't found any examples. I would like to set a flag based on the context, then run the built-in edit. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hello, So Let me know if this is what you are looking for. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Ahh I think I've got it. So I see two ways for you to solve this: 2 - Actually make the Edit Button, Select the Row so you can have contextual access to the row (your selectedDetail). @stsrki Example: @context.ReadCell( "SomeFieldName" ); |
Beta Was this translation helpful? Give feedback.
Ahh I think I've got it.
You're trying to do "contextual validation". So, basically Validator only gives you access to the value being validated, Validator does not access the context (Item being edited) unless you have it in memory (Selected Row).
So I see two ways for you to solve this:
1 - For contextual validations, bind to the RowUpdating Eventcallback, and you will have access to the
CancellableRowChange<TItem, Dictionary<string, object>> where you will have the original state of the Item and a dictionary of the Values that have now been edited. You can do additional validation here, and if it fails, you can cancel the row update.
2 - Actually make the Edit Button, Select the Row so…