How can I prevent tab characters etc. from being pasted into an asp.net textbox?

Posted by Neal on Stack Overflow See other posts from Stack Overflow or by Neal
Published on 2010-12-24T01:48:29Z Indexed on 2010/12/24 1:54 UTC
Read the original article Hit count: 498

Filed under:
|

Hello,

I'd like to have an asp.net textbox that people can paste content into and it works like notepad, i.e. no formatting or special characters will get entered. I take text and pass it to a web service which manipulates it and converts it into a tab delimited file. The problem I've experienced is sometimes people copy from MS Word and paste that content in and somehow even the tab characters etc. get passed to the web service. I run routines now to strip that information out but it would be so much easier if the textbox on the web page didn't capture anything but the text itself, i.e. visible characters (numbers, letters, punctuation).

Anyone have a suggestion to have a textbox that doesn't capture formatting and non-visual characters?

Thank you.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about textbox