Hi there. I have a TextBox and a Label, in a ASP.NET + C# + JavaScript page.

The TextBox have a onKeyUp event, that calls the ValidateDate function (accepts only numbers):

TextBox.Attributes.Add("onKeyUp", "return ValidateDate (this)");

function ValidateDate (txtBox) {
if ("0123456789".indexOf(txtBox.value.substr(txtBox.value.length-1, 1)) == -1)
txtBox.value = txtBox.value.substr(0, txtBox.value.length-1);

This code works fine, but I want more!! How do I do to, when the user types an incorrect character, a error text appears in my Label?

<asp:TextBox id="TextBox" runat="server"></asp:TextBox>
<asp:Label id="Label" runat="server"></asp:Label>