2013年的文本框验证 [英] Textbox validation for year 2013

查看:64
本文介绍了2013年的文本框验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文本框验证
===================

如何验证文本框以输入下一年的日期.

它不能接受去年.只能接受以后的年份.


请帮忙.

谢谢

Textbox validation
===================

How to Validate textbox to enter next year date.

it must NOT accept last year.. only it should accept forward years.


Please help.

Thank you

推荐答案

您可以使用CompareValidator.请按照以下步骤操作:

1.从工具箱中将CompareValidator拖放到所需的合适位置.
2.将Operator设置为GreaterThan
3.将ControlToValidate属性设置为TextBox(具有年份)
4.将页面加载事件中的ValueToCompare设置为当年

告诉我是否有帮助.如果没有,请发表评论,我将相应地修改答案.谢谢.
You can use CompareValidator for that. Follow the steps:

1. Drag and drop a CompareValidator from the toolbox to a suitable place you like.
2. Set the Operator to GreaterThan
3. Set the ControlToValidate property to the TextBox (which has the year)
4. Set the ValueToCompare on the Page Load Event to the current year

Do tell me if that helps. If not, please comment and I will modify the answer accordingly. Thanks.



您是否注意到您发布了相同的问题 www.codeproject.com/Answers /422080/how-to-validate-textbox-with-previous-year [
Hi ,
Did you noticed that you post the same Question www.codeproject.com/Answers/422080/how-to-validate-textbox-with-previous-year[^]
Go and Check there it''s already Answer
Best Regards
M.Mitwalli




如果您的要求取决于系统日期,则仅接受当前系统年的下一年.


在验证时,您将检查文本框"值是否等于
Hi,

If your requirement is like that depending on System Date you only accept Next Year of current System Year.


In time of validation you will check Text Box value is Equals to
System.DateTime.Today.Year+1

或如果不是,则抛出一些验证错误

:)

如果在Web上尝试,则OnLoad会将当前Year值放在会话中的On上的On On On Cookie上,然后在On Submit上使用Javascript通过编写一些JavaScript进行检查.

您是否需要该Java脚本

or not if not then throw some validation error

:)

If you try it on web then OnLoad put current Year value at hidden field On in Session On Cookie and Then On Submit check using Javascript by writing some javascript.

Do you need that java script


这篇关于2013年的文本框验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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