Validating 2 controls together???

Results 1 to 2 of 2

Thread: Validating 2 controls together???

  1. #1
    Join Date
    Dec 1969

    Default Validating 2 controls together???

    I have a validation requirement which requires that one of two dropdownlist controls have a value but not both.<BR>DropDownList1 or DropDownList2 can have and must have a value but not both.<BR>I tried using a custom validator but that did not work. Anyone had suck a problem? Did you solve? Can you share your knowledge?<BR>Thanks<BR><BR>PS I pried using PeterBlum&#039;s Group control but that did not work at all.

  2. #2
    Join Date
    Dec 1969

    Default RE: Validating 2 controls together???

    The logic in the custom validator would be:<BR><BR>if (dropdown1.SelectedIndex &#060;&#062; 0 && dropdown2.SelectedIndex &#060;&#062; 0) {<BR>&nbsp;&nbsp;&nbsp;//is NOT valid<BR>}<BR>else {<BR>&nbsp;&nbsp;&nbsp;//is valid<BR>}<BR><BR>I have used this general logic many times in classic without any problems. And I know this can be done with ASP.NET custom validator as I have seen it, but never had to implement yet.<BR><BR>Post your code if you are still having troubles.<BR><BR>O&#039;Cary<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts