如何将必填字段验证器用于许多控件 [英] How to use Required field validators for a number of controls

查看:39
本文介绍了如何将必填字段验证器用于许多控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我必须验证一个字段,则可以使用必需的字段验证器,但是我的表单中有很多字段.
所以,请回答我该怎么办?

在此先感谢您的答复.

If i have to validate one field, I can use required feild validator, but I have a lot of feild in the form.
So, kindly reply what can I do?

Thanks in advance for your responses.

推荐答案

您正在发布标题为关于ASP.NET的问题"的问题编号.在发布问题之前,您应该先阅读问题的发布方式.在此处阅读: http://www.codeproject.com/Questions/ask.aspx [ 您应该正确地提出问题,并详细说明做什么,为什么要做某事以及在哪里受困.



现在,即使您有多个字段,每个字段所需的字段验证器也可以.如果您对使用它们持怀疑态度,那么在页面提交时,请调用JS方法,在其中检查所有输入字段值.如果任何一个为空并且是必需的,则显示警报并停止提交页面.

试试看,现在问一个具体问题.
You are posting number of question with title ''Question regarding ASP.NET''. You should read on the way question should be posted before posting it. Read here: http://www.codeproject.com/Questions/ask.aspx[^]

Your title should be short and sweet related to what you ask.
You need to tag it correctly to ASP.NET if it is related to that
You need to use comment feature using ''having a Question or comment'' link to discuss an answer instead of posting a new question as a followup
You should frame your question properly with details on what and why you are doing something and where are you stuck.



Now, even if you have multiple fields, required field validator for every field is OK. In case you are skeptical on using them then you at the time of page submit, call a JS method where check all the input field values. If any one is empty and is required then show an alert and stop submit of the page.

Try out and now ask specific question.


嗨破折号,
您可以采用任何形式的验证程序控件,但此处一个控件仅支持唯一的验证程序控件.

例如:

textboxid1 -----> requirefielvalidator1,rangevalidator1

textboxid2 ----> requirefielvalidator2,rangevalidator2

但是假设在这里,如果您同时为两个文本框控件使用rangevalidator1,它将不支持.


现在您可以根据您的要求保留任何验证器,但请记住示例变化.
谢谢
hi dash ,
YOU can proceed any validator controls in form, but here one control supports only unique validator control.

ex:

textboxid1-----> requirefielvalidator1,rangevalidator1

textboxid2 ----> requirefielvalidator2,rangevalidator2

but suppose here if u take rangevalidator1 for both textbox controls it will n''t support.


Now u can keep any validators depend on your requirement but please keep the in mind example variation .
thank you


这篇关于如何将必填字段验证器用于许多控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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