cancel
Showing results for 
Search instead for 
Did you mean: 
aleksey_grigore
Nintex Newbie

How to add validation in custom control?

I created a control LookupListItemPicker, who inherited from EntityEditorWithPicker. Next, I created a custom control LookupControl, who inherited from BaseBindableFormControl. Next, try to add validation of input values in a lookup field. How can I do it?

Labels: (1)
Reply
3 Replies
michael_creek
Nintex Newbie

Re: How to add validation in custom control?

validation for what?  Number?  Text?  the value itself?

Can you use a hidden field computed from the field you are wanting to validate and validate it?

Reply
aleksey_grigore
Nintex Newbie

Re: How to add validation in custom control?

I'm trying to make a control array lookup values from a list using the Sharepoint class EntityEditorWithPicker. If I make this control and use in Sharepoint, it works correctly, once I transfer the code to the control Nintex, the validation is not working. Below is an example in which I record the CustomValidation:

 protected override void CreateValidationControls()
{
if (this.LookupProperties.IsRequired)
{
RequiredFieldValidator requiredFieldValidator = new RequiredFieldValidator();
requiredFieldValidator.ID = "requiredFieldValidator";
requiredFieldValidator.ControlToValidate = this.AssociatedControlForLabel.UniqueID;
requiredFieldValidator.ErrorMessage = string.IsNullOrEmpty(this.LookupProperties.RequiredErrorMessage) ? string.Empty : this.LookupProperties.RequiredErrorMessage;
this.RequiredFieldValidator = (BaseValidator)requiredFieldValidator;
this.ApplyCommonValidatorSettings(this.RequiredFieldValidator);
this._lookupControl.Controls.Add((Control)this.RequiredFieldValidator); 

This approach does not work, because the engine ASP.NET can't find the control for which to make the validation. I don't know what I'm doing wrong.

Sorry for my English.

0 Kudos
Reply
michael_creek
Nintex Newbie

Re: How to add validation in custom control?

...way beyond me, sorry can't help!!

0 Kudos
Reply