Domnic
Domnic

Reputation: 3867

asp.net to check character

i have one text box ....if i type character how can i check it is characte in asp.net (application layer)

Upvotes: 0

Views: 337

Answers (2)

tjmoore
tjmoore

Reputation: 1084

I would recommend looking into the .net validator controls for this. They provide a wide range of input validation facilities.

http://msdn.microsoft.com/en-us/library/7kh55542.aspx

Upvotes: 0

Ciprian Bortos
Ciprian Bortos

Reputation: 224

For checking the text entered in a textbox, you might want to use the TextChanged event, which is triggered only after the textBox loses focus. You can hook it up either in javascript (client) or in code (server).

Another option is to have some validator to restrict the allowed characters. You might want to take a look at this article from MSDN: http://msdn.microsoft.com/en-us/library/ms998267.aspx (How To: Use Regular Expressions to Constrain Input in ASP.NET).

Upvotes: 2

Related Questions