I have several asp.net validators.
I want to show all(except one) error messages in validation summary.
How can I not show the remaining one in validation summary but in other places?
Could you put the one you don't want to show in a different ValidationGroup to the rest?
Use the Text property of the validator to show in the validator itself. The ErrorMessage property is what is displayed in the ValidationSummary
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.basevalidator.errormessage.aspx
Related
I have a new validator added to one screen to validate a text box. If user clicks on submit button, the validation summary will pop up but not showing the text of this validator. It works well with all other validators on this page.
In other words, this validator works but is not shown in the validation summary.
Check if you use the same name as the default validation group may not verification. I suggest you to check out her hard have added value.
I figured it out, I used the Text property of the validator instead of ErrorMessage property. Thanks for your comment #MichaelLiu which made me look at the code.
In one of our projects we want to show the "Required field validation error" by changing the border color of the corresponding textbox. our page contains a lot of required field validator,regular expression validator etc. But we want to highlight only the required field errors.
Is there any way to do this without using any custom validation function.?
or Is there any method to find all the required field validators in a page in the client side. If we can find this i think we can highlight the corresponding error textbox
one option, maybe less annoying than switching to custom validators, is to create your own javascript validation function that is triggered with a submit click. from here you can change the appearance of the invalid fields.
i have two check boxes with male/female and i would like to add a required field validator for them so if none is checked then a custom error appears, i can already do this but with one control not two.
thanks
All I needed to do was instead of adding two separate CheckBoxs ,I needed to add a CheckBoxList:
CheckBoxList
and then use a normal RequiredFieldValidator on the CheckBoxList:
RequiredFieldValidator
You'll need to use the CustomValidator with a ClientValidationFunction
http://forums.asp.net/t/1402179.aspx
or -
You'll need to write a custom control or use one that's already made:
-http://www.codeproject.com/KB/validation/MultiDependValidator.aspx
I am using an ajax tab control. I am using a combination of required field validators and custom validators. I am using a validation summary at the end of the page. My problem is when there is a validation error on different tabs I get an IE error because it cannot set focus on all of the fields at once because they are on different tabs. I know if I set focus on error to false the error does not occur. Is there any other way around this?
Set the ValidationGroup of groups.. for more info click
Why are my errors showing up beside my control and in the validation control summary?
By default if you have a ValidationSummary control, the error message shows in both places. If you want the error message to only show in the ValidationSummary, then set the Display property in your validation control to None.
From the BaseValidator.Display Property:
None The validation message is never displayed inline.
Static Space for the validation message is allocated in the page layout.
Dynamic Space for the validation message is dynamically added to the page if validation fails.
Most likely because you did not set
Display="None"
in your validation control. By setting Display to None you are indicating that you do not want the error message to appear in the place of the validation control itself, only in the validation summary.