Solved

Using eval function to change comparison operator in a compare validator

Posted on 2013-06-17
1
319 Views
Last Modified: 2013-06-25
I have a compare validator that compares the values of two text boxes:

This works the way I want if the user has selected  "fixedrate" from a dropdown:  
  <asp:CompareValidator ID="CompareValidator_walk_season1" runat="server"  ErrorMessage="LRA must be greater than NLRA" ControlToCompare="NLRA_season1"
          ControlToValidate="LRA_season1" Operator="GreaterThan" Type="Currency" Display = "Dynamic" CssClass = "ErrorMessage"></asp:CompareValidator>

However, if the user has selected "PercentOff' from that dropdown, I need everything the same,except the comparison operator needs to change to "less than"

Is is possble to use the eval function to change the comparison operator based on the value of the dropdown, and how would that code look, assuming drop down is ddlRateType

Thanks!
0
Comment
Question by:dond123
1 Comment
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39255837
in your server side, add event handler selection changed to ddlRateType.
inside the handler update the Operator property of CompareValidator_walk_season1 to LessThan, if user select "PercentOff".
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question