c# - Validate textbox depending on external parameter -
i have window 8 rows representing 8 output channels, in each channel can have timesteps. have textbox in front of each channel set upper , lower limit value of timesteps. want write validator checks user input if it's inside of limits. i'm not sure how this, because when validator invoked has no knowledge timestep in channel it's called , see no possibility pass information validator.
edit:
public class numbervalidator : validationrule { public override validationresult validate (object value, system.globalization.cultureinfo cultureinfo) { double number = 0; try { number = convert.todouble(value.tostring()); // check numeric value } catch (exception) { return new validationresult(false, "value must numeric"); } if (number == 0) // check non-zero value { return new validationresult(false, "value must non-zero"); } return new validationresult(true, null); } } this how use validator normally, compare input constant value. problem instead of comparing number being equal zero. want compare number attribute of object, i'm not sure how pass other object validator.
Comments
Post a Comment