Solved

Using eval function to change comparison operator in a compare validator

Posted on 2013-06-17
1
313 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now