This code validate a text box to cantain only alphabets.
If u want to change then you can replace IsLetter to any type .
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
if (TextBox1.Text.All(chr => char.IsLetter(chr)))
{
Label1.Text = "ok";
}
else
{
Label1.Text = "not ok";
}
}
If u want to change then you can replace IsLetter to any type .
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
if (TextBox1.Text.All(chr => char.IsLetter(chr)))
{
Label1.Text = "ok";
}
else
{
Label1.Text = "not ok";
}
}
No comments:
Post a Comment