I have many TextBox in a page.
I would like to know if there is a ways to check pro grammatically all input for this TextBox and
apply Server.HtmlEncode to each one.
So I do not need apply Server.HtmlEncode for every single String.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’d need to create a utility method for that. Something on the lines of:
Simple version if no nested text controls present:
A bit complex version which considers all the textboxes present on a page:
The above method uses a method called FlattenChildren which can be taken from here.
Secondly, I havent used an editor for typing that code..