RequiredFieldValidator myRFV = new RequiredFieldValidator();myRFV.ControlToValidate = "myDDL1";myRFV.ErrorMessage = "you must select a value!";form1.Controls.Add(myRFV);
Int32 myCount = 1;
RequiredFieldValidator myRFV + myCount = new RequiredFieldValidator(); // myRFV + myCount does not work!!!myRFV + myCount.ControlToValidate = "myDDL1";myRFV + myCount.ErrorMessage = "you must select a value!";form1.Controls.Add(myRFV + myCount); myCount = 2;RequiredFieldValidator myRFV + myCount = new RequiredFieldValidator();myRFV + myCount.ControlToValidate = "myDDL2";myRFV + myCount.ErrorMessage = "you must select a value!";form1.Controls.Add(myRFV + myCount);
myCount = 2;
RequiredFieldValidator myRFV + myCount = new RequiredFieldValidator();myRFV + myCount.ControlToValidate = "myDDL2";myRFV + myCount.ErrorMessage = "you must select a value!";form1.Controls.Add(myRFV + myCount);