Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
NumericEditor with validatorOptions
posted

I have a numericeditor in mvc code as:

It's ok with:

$('#numtest).igNumericEditor({
value: "0",
validatorOptions: {
onblur: true,
required: true,
custom: function (value, opt) { return (value > 0);} 
}
});

but didn't work:

@Html.Infragistics.NumericEditor("numtest", "numtest", 0).ValidatorOptions(Sub(o)
    o.OnBlur(True)
    o.Required(True)
    o.Custom("function (value, opt) { return (value > 0);}", "Value must be greater than zero")
End Sub).Render

What is syntax for o.Custom("???", "error msg")?

Parents
No Data
Reply
  • 2895
    Verified Answer
    posted

    Hello Quan,

    Thank you for using our community.

    The syntax of the custom option is as follows:

    @(Html.Infragistics().NumericEditor()

           .ID("numericEditor")

           .Value("0")

           .ValidatorOptions(x=>

                  x.OnBlur(true)

                  .Required(true)

                  .Custom("validate", "Value must be greater than zero"))

           .Render())

     

    <script>

           function validate(value) {

                  return (value > 0);

           }

    </script>

     

    If you need further assistance, don’t hesitate to contact me.

    Best Regards,
    Marina Stoyanova,
    Software Developer,
    Infragistics, Inc.

Children
No Data