Link to home
Start Free TrialLog in
Avatar of WDJ98338
WDJ98338Flag for United States of America

asked on

How to change the textbox background color when the Regular expression shows an error?Bookmark:Question:

Instead of using the error message "Error" I would like to change the textbox txtzipcode  background red using CSS can this be done.

<form id="form1" runat="server">
    <div>
   
        <asp:TextBox ID="txtzipcode" runat="server"></asp:TextBox>
        <asp:RegularExpressionValidator ID="ValZipcode" runat="server"
            BorderStyle="None" ControlToValidate="txtzipcode"
            ErrorMessage="Error"
           
           
            ValidationExpression="^((\d{5}-\d{4})|(\d{5})|([AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\d[A-Za-z]\s?\d[A-Za-z]\d))$"
            ForeColor="#FF3300"></asp:RegularExpressionValidator>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" />
   
    </div>
    </form>
ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial