RequiredFieldValidator
-
i want create a RequiredFieldValidator in my form in c#.net programatically . but i dont know where should i write thats code. i write this below codes but where should i put them? protected RequiredFieldValidator validator; validator.ControlToValidate = "TextBox1"; validator.ErrorMessage = "*"; validator.EnableViewState = true; validator.EnableClientScript = true; validator.Display = ValidatorDisplay.Dynamic; validator.EnableTheming = true; validator.Enabled = true; validator.ID = "validator1"; Page.Form.Attributes.Add("validator1", "validator");
-
i want create a RequiredFieldValidator in my form in c#.net programatically . but i dont know where should i write thats code. i write this below codes but where should i put them? protected RequiredFieldValidator validator; validator.ControlToValidate = "TextBox1"; validator.ErrorMessage = "*"; validator.EnableViewState = true; validator.EnableClientScript = true; validator.Display = ValidatorDisplay.Dynamic; validator.EnableTheming = true; validator.Enabled = true; validator.ID = "validator1"; Page.Form.Attributes.Add("validator1", "validator");
add it in page_Load()
Best Regards ----------------- Abhijit Jana "Success is Journey it's not a destination"
-
i want create a RequiredFieldValidator in my form in c#.net programatically . but i dont know where should i write thats code. i write this below codes but where should i put them? protected RequiredFieldValidator validator; validator.ControlToValidate = "TextBox1"; validator.ErrorMessage = "*"; validator.EnableViewState = true; validator.EnableClientScript = true; validator.Display = ValidatorDisplay.Dynamic; validator.EnableTheming = true; validator.Enabled = true; validator.ID = "validator1"; Page.Form.Attributes.Add("validator1", "validator");