Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
validation expression for multiline textbox allowed special char but not allowed character.
Posted
Updated 16-Apr-12 2:53am
v3
Comments
hamid-shrk 16-Apr-12 8:29am    
hi,
what is your regular expersion for not allowed characters?
vino2012 16-Apr-12 9:49am    
Don't ask same question, Update changes to your question on existing.....

1 solution

Use this javascript function with your textbox control onkeypress event
i.e. onKeyPress="return checkCharacters(event)" in CS

C#
function checkCharacters(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode != 32 && charCode > 31 && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122)) {
        status = "This field accepts numbers only."
        return false
    }

    status = ""
    var name = document.getElementById("txtloginID");
    name.innerHTML = Server.HtmlDecode(name);
    return true
}


hope this will help you thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900