I am creating a webpage (not windows form) where textbox should take only 10 numeric digits, This is not a duplicate question as

if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) &&
    (e.KeyChar != '.'))
{
        e.Handled = true;
}

giving error for missing reference assembly (This is only for Windows form). When I am setting TextBox property to numeric-only MAXLENGTH function is not working, and when setting to TEXT instead of numeric, MAXLENGTH is working but then it is accepting characters also. I don't want to check this while submitting the value, this should be checked when the user is entering a value in TextBOX. Appreciate any help/advice/comment.

Related posts

Recent Viewed