.net - Prevent same value chosen in several dropdown lists -
I have four dropdown lists with the same item / value. When I upload the form, I want to stop at the same price. How can I do this using a custom verifier? Thanks!
I will advocate the first solution of the cura to modify the dropdown lists so that the selection of the same value Can not be done, it is always better to stop the problem, tell the user what they did was wrong. However, if you want to use the following code, it will work:
& lt; Asp: CustomValidator id = "Dropdown Validation" runtat = "server" onsvvitadet = "dropdownwise validation_servised" error message = "The price can not be selected in more than one drop down." / & Gt;
And after that in the code behind, or a script tag.
Secure blank dropdown Validation_ServerValidate (Object Sender, ServerValidateEventArgs e) {e.IsValid =! HaveSameValue (Dropdown List 1. Selected Price, Dropdown List 2. Selected Price) & amp; Amp; ! Usage (dropdown list 1. Selected price, dropdown list 3. Selected price) & amp; Amp; ! The value (dropdownlist 1. Selected price, dropdown list 4. Selected price) & amp; Amp; ! Succinct (dropdown list 2. Selected price, dropdown list 3. Selected price) & amp; Amp; ! Succinct (dropdown list 2. Selected price, dropdown list 4. Selected price) & amp; Amp; ! Succinct (dropdown list 3. Selected price, dropdown list 4. Selected price); } Safe Hair is the value (string first, string second) {if (first! = Null & seconds! = Null) {back before that first Aquales (second); } Return first == Tap & amp; Amp; Second == faucet; }
This can be clearly and refined, and a javascript function can be used to verify client side if you want to use the property.
Comments
Post a Comment