You will probably find that a much cleaner approach to this problem is to set the CommandName and CommandArgument of each button and instead of using OnClick use a shared OnCommand handler.
That handler will accept a CommandEventArgs parameter instead of an EventArgs parameter, and you'll be able to interrogate it directly to see the CommandName and CommandArgument of the button clicked.