This is because the button is located inside the update panel, which is the "Container", and you are trying to get the DataItemIndex of this UpdatePanel, which obviously does not exist.
Could you pass the "Id" of the element that you will save to the CommandArgument directly with Eval ("WhateverId")?
EDIT: if you really need a DataItemIndex, this will get it for you:
<%# ((ListViewDataItem)Container).DataItemIndex %>
source share