在vb.net的服务器端验证文本框 [英] Validating textbox at server side in vb.net

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

问题描述

如何在服务器端验证文本框

how to validate textbox at server side

推荐答案

使用CustomValidator服务器控件进行服务器端验证.
http://msdn.microsoft.com/en-us/library/aa479013.aspx [ ^ ]
选中清单15
Use CustomValidator server control for server-side validation.
http://msdn.microsoft.com/en-us/library/aa479013.aspx[^]
Check Listing 15


,如果文本框具有runat="server",则只需通过其名称进行访问即可,并使用Text 属性.
Provided the textbox has runat="server", then just access it via it''s name, and use the Text property.


要在服务器服务器端进行验证,有两种方法,

使用验证控件或手动验证.

1.要使用验证控件应用验证,可以使用CustomValidator.使用此控件,您还可以应用客户端验证.

检查以下链接以了解所有验证控件的想法,

http://www.w3schools.com/aspnet/aspnet_refvalidationcontrols.asp [
To validate at server server side, there are 2 ways,

Either use validation control or validate manually.

1. To apply validattion using validation control you can use CustomValidator. Using this control you can apply client side validation as well.

Check the following link to get the idea of all the validation control,

http://www.w3schools.com/aspnet/aspnet_refvalidationcontrols.asp[^]


2. To Validate manually, just check your control value from code at server side and show message on label if the data is invalid.


这篇关于在vb.net的服务器端验证文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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