Solved

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

Posted on 2009-04-13
1
218 Views
Last Modified: 2012-05-06
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>
0
Comment
Question by:WDJ98338
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 500 total points
ID: 24135910
Hi WDJ98338,
You can apply the CSS changes whenever errors thrown via customvalidator instead of regularExpressionValidator control. Here is the similiar thread that mentioned same idea:
http://forums.asp.net/t/1335497.aspx

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question