Solved

Using eval function to change comparison operator in a compare validator

Posted on 2013-06-17
1
324 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

695 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