If you are using a GridView
you can get the EditIndex by calling:
int editIndex = yourGridView.EditIndex
If you are using the old DataGrid control, you can call EditItemIndex:
int editIndex = yourDG.EditItemIndex
If your code doesn't work as you expect, is likely that you are probably rebinding the data on every postback and hence, the EditItemIndex
(or EditIndex
depending on the actual control you are using) is therefore reset to the original state.