Frequently Asked Interview Questions

ASP.NET Validation Controls FAQS 2

ASP.NET Validation Controls FAQS page 2
Validation groups allow you to group validation controls on a page as a unit. Each validation group can perform validation independently from other validation groups on the page.
You create a validation group by setting the ValidationGroup property to the same name (a string) for all the controls you want to group. You can assign any name to a validation group, but you must use the same name for all members of the group.
During postback, the Page class's IsValid property is set based only on the validation controls in the current validation group. The current validation group is determined by the control that caused validation to occur. For example, if a button control with a validation group of LoginGroup is clicked, then the IsValid property will return true if all validation controls whose ValidationGroup property is set to LoginGroup are valid.
Yes, DropDownList control can also fire validation if the control's CausesValidation property is set to true and the AutoPostBack property is set to true.
Call the Page.Validate(string GroupName) method and pass the name of the validation group. This will fire only the validation controls in that validation group.
To show validation error message in messagebox, we need to set below properties of ValidationSummary control.
ShowMessageBox ="true" and ShowSummary="false"
Inline: Each validation control can individually display an error message in place i.e, next to the control where the error occurred.

Summary: Validation errors can be collected and displayed in one place

In place and summary: The error message can be different in the summary and in place. We can use this option to show a shorter error message in place with more detail in the summary.

Custom: We can customize the error message display by capturing the error information and designing our own output.

Most Visited Pages

Home | Site Index | Contact Us