Here is a way of changing back ground color for Textbox on validation failure. The key here is using Page_ClientValidate function in javascript.
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter a value"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="btnClick();"
OnClick="Button1_Click1" />
<script type="text/javascript">
function btnClick()
{
if (!Page_ClientValidate())
{
document.getElementById("TextBox1").style.backgroundColor="red";
}
}
function ClearBackGround()
{
document.getElementById("TextBox1").style.backgroundColor="";
}
</script>
In Code behind
TextBox1.Attributes.Add("onkeypress", "ClearBackGround()");