Sunday, April 1, 2012

Allow only numeric or Characters to Textbox

Title:How to allow only Numeric (Numbers) or Characters to Text box in asp.net

Description:
As per previous articles we have seen how to do this kind of functionality using JQuery . Now i would like to explain how to do with asp.net using vb.net.Here an event procedure will be executed before key value is applied to text box.This event procedure allowed developer to kill the functionality of key.
Example:
//keypress event
msgbox("keypresslogic")
msgbox(e.Keychar&" "&Asc(e.Keychar)
If Asc(e,Keychar)=8 Then
Exit sub
EndIf
//To allow numeric
If(char.IsDigit(e.Keychar)=Flase Then
e.Handled=True
MsgBox("enter numeric)
EndIf
EndSub

No comments:

Bel