Causes validation.
-
Hello all! Happy new year! :-) I have a problem with a bizarre ImageButton. It keeps "causing validation". It is part of a table and I use the following code to create it (C#):
ImageButton cmdDelete = new ImageButton();
cmdDelete.CommandName = "Delete";
cmdDelete.CommandArgument = p.DbId.ToString();
cmdDelete.Command += DeleteRecipient;
cmdDelete.ImageUrl = "~/Images/trash.gif";
cmdDelete.CausesValidation = false;
cmdDelete.OnClientClick = "javascript:Page_ValidationActive=false;";1. Causes validation is false. 2. OnClientClick is set to "Page_ValidationActive=false" - which I've heard should be equal to 1., just for the client. Now it behaves like this: The first time it is clicked, it does not cause validation, and the user is deleted and removed from the list. If I click to delete another user, suddenly the button causes validation. If I click it again, it does not! And so on, and so on. I've tried stepping through the code, and every second time the button is clicked, it causes validation. Validation occurs server side, since I've tried turning off JavaScript, and the exact same pattern occurs. I'm kind of confused! LOL! :-) Best regards Soeren