In order to validate string only input, you can use OnKeyDown Client-side event in WebCombo.
In this topic, you will learn how to implement the method.
To validate string only input Client-side event
- Drag a WebCombo instance into the WebForm.
- Add the following code in client side:
JavaScript Copy Code function WebCombo1_OnKeyDown() { var n =""; var e = window.event; if (48<=e.keyCode && e.keyCode<=57) n = e.keyCode - 48; else if (96<=e.keyCode && e.keyCode<=105) n = e.keyCode - 96; else if (e.keyCode==110 || e.keyCode==190) n = "."; if (n != "") return false; else return true; }
- Invoke WebCombo1_OnKeyDown() function in OnKeyDown client side event of WebCombo.
- Run the project.