/// <summary> /// Creates a numeric-text control with the value expressed as a long. /// </summary> /// <param name="setup">The setup object for the control. Do not pass null.</param> /// <param name="validationMethod">A function that validates the value entered by the user and returns a result. Do not pass null.</param> public static NavFormControl CreateNumericTextAsLong(NavFormControlSetup setup, Func <long, NavFormControlValidationResult> validationMethod) => new NavFormControl( setup, validationResultHandler => { var val = new DataValue <long>(); return(val.ToTextControl( setup: setup.AutoCompleteResource != null ? NumericTextControlSetup.CreateAutoComplete( setup.AutoCompleteResource, placeholder: setup.Placeholder, triggersActionWhenItemSelected: true) : NumericTextControlSetup.Create(placeholder: setup.Placeholder), value: new SpecifiedValue <long?>(null), additionalValidationMethod: validator => validationResultHandler(validationMethod(val.Value), validator))); });
/// <summary> /// Creates a numeric-text control with the value expressed as a string. /// </summary> /// <param name="setup">The setup object for the control. Do not pass null.</param> /// <param name="validationMethod">A function that validates the value entered by the user and returns a result. Do not pass null.</param> public static NavFormControl CreateNumericTextAsString(NavFormControlSetup setup, Func <string, NavFormControlValidationResult> validationMethod) => new NavFormControl( setup, validationResultHandler => { return(new NumericTextControl( "", false, setup: setup.AutoCompleteResource != null ? NumericTextControlSetup.CreateAutoComplete( setup.AutoCompleteResource, placeholder: setup.Placeholder, triggersActionWhenItemSelected: true) : NumericTextControlSetup.Create(placeholder: setup.Placeholder), validationMethod: (postBackValue, validator) => validationResultHandler(validationMethod(postBackValue), validator))); });