任何文本框的必填字段velidator否 [英] required field velidator for any textbox for prime no

查看:72
本文介绍了任何文本框的必填字段velidator否的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我编写compsite no时,c#中存在任何必填字段velidator,然后它将打印输入质数no

Any required field velidator is exist in c# when i write compsite no then it will print enter prime no

推荐答案

RequiredFieldValidator 本身就是一个验证器,即用于检查用户输入.在此问题中,您需要为此检查质数,您需要使用CustomValidator 控件,然后您需要编写一种检查质数的方法,然后在CustomValidatorOnServerValidate 属性中调用此方法. > 有关更多详细信息,请参见以下链接:
使用CustomValidator控件 [ CustomValidator控件 [
RequiredFieldValidator is a validator itself, that is used for checking the user input. Here in your question you need to check prime numbers for this you need to use CustomValidator control, Then you need to write a method for checking the prime numbers then call this method in OnServerValidate property of CustomValidator.
For more details please see below links:
Using the CustomValidator Control[^]
CustomValidator Control[^]

Good luck.
--Rajesh


由于您谈到了requiredField验证器,即使您未将其标记为ASP.NET,我也假定您正在使用Web应用程序.
现在,您可以使用CustomValidator来实现您的目标:
MSDN:CustomValidator类 [ ^ ]


顺便说一句,您还有其他方法,例如,在页面提交或在文本框控件的文本更改上引发验证事件.在此客户端事件中,检查其是否为质数,并在不存在质数的情况下显示一条消息.
Since you talked of requiredField validator, I assume you are working on a web application even though you have not tagged it as ASP.NET.

Now, what you seek can be achieved using a CustomValidator: MSDN: CustomValidator Class[^]


BTW, you have other ways like, raising a validation event on page submit or the text change of the textbox control. In this client side event, check if it is a prime or not and display a message in case not.


使用自定义验证器,并将质数的逻辑放入ServerValidation方法中.
http://msdn.microsoft.com/zh-CN/library/9eee01cx(v = vs.80) [ ^ ]
use custom validator and put the logic for prime number in ServerValidation method.
http://msdn.microsoft.com/en-US/library/9eee01cx(v=vs.80)[^]


这篇关于任何文本框的必填字段velidator否的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆