Hi Kumar,
This is what I have done and it is working:
1) I have created a TextBox
2) I have created a required field validator also dynamically and set the
ControlToValidate property to the ID of the above created TextBox.
3) I have added both text box and required field validator to a div, div is there in the aspx page.
TextBox txt = new TextBox();
txt.ID = "DynControl";
RequiredFieldValidator rfv = new RequiredFieldValidator();
rfv.ErrorMessage = "Error is for Dynamic Control";
rfv.BorderColor = Color.Red;
rfv.ControlToValidate = "DynControl";
divTest.Controls.Add(txt);
divTest.Controls.Add(rfv);
4) I kept a button in the page and on this button click,
Required field validation is firing
I hope this will help you in resolving your issue.