验证文本输入

问题描述:

如何根据应用程序的各种条件实现文本框输入的验证.正确的方法或最佳做法是什么.

How can I implement the Validation for textbox input based on various conditions for the application.What is the right way or the best practice of doing it.

目前,我正在对每页后面的代码中的每个条件进行直接检查.

Currently I am doing a straight check for each condition in the code behind of each page.

文本框的条件不同.

请帮助.

通常,您可以使用 TextBox.InputScope 设置输入上下文.如果不足够,您可以修改或将其替换为自己的代码.

In general you can use the TextBox.InputScope to set the context for input.  If it is inadequate you can amend or replace it with your own code behind.

希望这会有所帮助,
标记

Hope this helps,
Mark