SetFocusOnError Property

Posted Friday, May 27, 2005 9:38 AM by C-Dog's .NET Tip of the Day
Another new property added to validator controls is the SetFocusOnError property.  This new property allows a developer to force focus on the control that did not pass validation.  This will be an excellent imrpovement for forms such as Blue Chip enrollment.  To force the focus, simply set the SetFocusOnError property to true.
<asp:TextBox ID="TextBox3“ runat="server“ />
<asp:RequiredFieldValidator  SetFocusOnError="true"
 ErrorMessage="TextBox3 is empty"   ControlToValidate="TextBox3"

Read the complete post at