Howdy!
In the course of developing the validation for user input in the website I am working on, I believe I have found a bug in the behavior of RadTextBoxes. My website's design calls for the user to be notified of invalid inputs by changing the color of the RadTextBox to red when the input is invalid. When the user corrects the input, the RadTextBox is supposed to turn white. However, after the second validation, the RadTextBox seems to retain a memory of the previous color and change to that color when the user mouses over the RadTextBox, despite no mouse-over behavior being defined.
For example, let us say that the RadTextBox is first loaded onto the page with white BackColor and no text. The user then enters some valid text, so the color stays white. If the user enters invalid text, the RadTextBox turns red (like it is supposed to). However, when the user mouses over the red RadTextBox, it turns white.
Now let us say that the RadTextBox is first loaded onto the page with white BackColor and some default text. The user then enters invalid text and the RadTextBox turns red (like it is supposed to). If the user then changes the text to something valid, the RadTextBox turns white, but when the user mouses over it, it turns red.
By playing around with how many valid inputs/invalid inputs are entered, it is possible to get the mouse over color to flash either the valid or invalid color. Note that this behavior DOES NOT occur with regular TextBoxes
I have included some sample HTML and C# below that demonstrates the issue. I would greatly appreciate some assistance in getting my RadTextBoxes to stay the proper color.
Thanks!
-----------------------------------------------------------------------------------------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadTextboxExample.aspx.cs"
Inherits="RadTextboxExample" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<asp:Label ID="Label1" runat="server" Text="RadTextBox - Start Empty"></asp:Label>
<telerik:RadTextBox ID="RadTextBox1" runat="server" AutoPostBack="True" CausesValidation="True"
OnTextChanged="RadTextBox1_TextChanged">
</telerik:RadTextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="RadTextBox - Start Full"></asp:Label>
<telerik:RadTextBox ID="RadTextBox2" runat="server" AutoPostBack="True" CausesValidation="True"
OnTextChanged="RadTextBox2_TextChanged" Text="Default Input">
</telerik:RadTextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="TextBox"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" CausesValidation="True"
OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
</div>
</form>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
public partial class RadTextboxExample : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
}
protected void RadTextBox1_TextChanged(object sender, EventArgs e) {
if (RadTextBox1.Text == "" || RadTextBox1.Text == null) {
RadTextBox1.BackColor = System.Drawing.Color.Red;
} else {
RadTextBox1.BackColor = System.Drawing.Color.White;
}
}
protected void RadTextBox2_TextChanged(object sender, EventArgs e) {
if (RadTextBox2.Text == "" || RadTextBox2.Text == null) {
RadTextBox2.BackColor = System.Drawing.Color.Red;
} else {
RadTextBox2.BackColor = System.Drawing.Color.White;
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e) {
if (TextBox1.Text == "" || TextBox1.Text == null) {
TextBox1.BackColor = System.Drawing.Color.Red;
} else {
TextBox1.BackColor = System.Drawing.Color.White;
}
}
}
-----------------------------------------------------------------------------------------------------------------------------------------------------
In the course of developing the validation for user input in the website I am working on, I believe I have found a bug in the behavior of RadTextBoxes. My website's design calls for the user to be notified of invalid inputs by changing the color of the RadTextBox to red when the input is invalid. When the user corrects the input, the RadTextBox is supposed to turn white. However, after the second validation, the RadTextBox seems to retain a memory of the previous color and change to that color when the user mouses over the RadTextBox, despite no mouse-over behavior being defined.
For example, let us say that the RadTextBox is first loaded onto the page with white BackColor and no text. The user then enters some valid text, so the color stays white. If the user enters invalid text, the RadTextBox turns red (like it is supposed to). However, when the user mouses over the red RadTextBox, it turns white.
Now let us say that the RadTextBox is first loaded onto the page with white BackColor and some default text. The user then enters invalid text and the RadTextBox turns red (like it is supposed to). If the user then changes the text to something valid, the RadTextBox turns white, but when the user mouses over it, it turns red.
By playing around with how many valid inputs/invalid inputs are entered, it is possible to get the mouse over color to flash either the valid or invalid color. Note that this behavior DOES NOT occur with regular TextBoxes
I have included some sample HTML and C# below that demonstrates the issue. I would greatly appreciate some assistance in getting my RadTextBoxes to stay the proper color.
Thanks!
-----------------------------------------------------------------------------------------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadTextboxExample.aspx.cs"
Inherits="RadTextboxExample" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<asp:Label ID="Label1" runat="server" Text="RadTextBox - Start Empty"></asp:Label>
<telerik:RadTextBox ID="RadTextBox1" runat="server" AutoPostBack="True" CausesValidation="True"
OnTextChanged="RadTextBox1_TextChanged">
</telerik:RadTextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="RadTextBox - Start Full"></asp:Label>
<telerik:RadTextBox ID="RadTextBox2" runat="server" AutoPostBack="True" CausesValidation="True"
OnTextChanged="RadTextBox2_TextChanged" Text="Default Input">
</telerik:RadTextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="TextBox"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" CausesValidation="True"
OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
</div>
</form>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
public partial class RadTextboxExample : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
}
protected void RadTextBox1_TextChanged(object sender, EventArgs e) {
if (RadTextBox1.Text == "" || RadTextBox1.Text == null) {
RadTextBox1.BackColor = System.Drawing.Color.Red;
} else {
RadTextBox1.BackColor = System.Drawing.Color.White;
}
}
protected void RadTextBox2_TextChanged(object sender, EventArgs e) {
if (RadTextBox2.Text == "" || RadTextBox2.Text == null) {
RadTextBox2.BackColor = System.Drawing.Color.Red;
} else {
RadTextBox2.BackColor = System.Drawing.Color.White;
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e) {
if (TextBox1.Text == "" || TextBox1.Text == null) {
TextBox1.BackColor = System.Drawing.Color.Red;
} else {
TextBox1.BackColor = System.Drawing.Color.White;
}
}
}
-----------------------------------------------------------------------------------------------------------------------------------------------------