G
Guest
Hi all,
I am developing a Custom ASP.NET Server Controls that generates a form based
on a xml file and want to include RequiredFieldValidator for mandatory
questions. I am using the following function:
private RequiredFieldValidator CreateRequiredFieldValidator(string
controlToValidateID, string errorMessage)
{
RequiredFieldValidator requiredFieldValidator = new
RequiredFieldValidator();
requiredFieldValidator.ControlToValidate = controlToValidateID;
requiredFieldValidator.Display = ValidatorDisplay.Dynamic;
requiredFieldValidator.ErrorMessage = errorMessage;
return requiredFieldValidator;
}
Everytime I want to include a requiredfieldvalidator i call this function as
follows:
RequiredFieldValidator requiredFieldValidator =
CreateRequiredFieldValidator(controlID, "Required field");
responsePanel.Controls.Add(requiredFieldValidator);
The responsePanel is a Panel control that maps to a html <div> element. I
leave the EnableClientScript enabled so that I can see the javascript code
that is generated. I saw the html source that is generated and it seems ok
and the ControlToValidate property is properly set with the right ids. All
the javascript functions are there or are in the included WebResource.axd
http handler. I even tried to set the EnableClientScript property to false
and it doesn't work also.
Any sugestions?
Thanks
Miguel
I am developing a Custom ASP.NET Server Controls that generates a form based
on a xml file and want to include RequiredFieldValidator for mandatory
questions. I am using the following function:
private RequiredFieldValidator CreateRequiredFieldValidator(string
controlToValidateID, string errorMessage)
{
RequiredFieldValidator requiredFieldValidator = new
RequiredFieldValidator();
requiredFieldValidator.ControlToValidate = controlToValidateID;
requiredFieldValidator.Display = ValidatorDisplay.Dynamic;
requiredFieldValidator.ErrorMessage = errorMessage;
return requiredFieldValidator;
}
Everytime I want to include a requiredfieldvalidator i call this function as
follows:
RequiredFieldValidator requiredFieldValidator =
CreateRequiredFieldValidator(controlID, "Required field");
responsePanel.Controls.Add(requiredFieldValidator);
The responsePanel is a Panel control that maps to a html <div> element. I
leave the EnableClientScript enabled so that I can see the javascript code
that is generated. I saw the html source that is generated and it seems ok
and the ControlToValidate property is properly set with the right ids. All
the javascript functions are there or are in the included WebResource.axd
http handler. I even tried to set the EnableClientScript property to false
and it doesn't work also.
Any sugestions?
Thanks
Miguel