If you get to the event handler you can use the sender object.
Button btn = (Button)sender;
if(btn.Text == "Edit"){
btn.Text = "Update";
}
else{
if(btn.Text == "Update"){
btn.Text = "Edit";
}
}
This is meant to be pseudocode. Work it out to a more stable and workable version.
hope this helps.