如何使用自定义验证器验证文本框? [英] how to validate the textbox using custom validator?

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

问题描述

我希望编码使用customvalidator来验证文本框,以检查单词是否与数据库wordcolumn匹配.
在这种情况下,txtbox应该由用户填充.
那么该单词应与数据库中的特定字段匹配.
并且db中匹配字段的行应显示在面板中.

i want coding to validate the textbox using customvalidator to check whether the word match with the database wordcolumn.
In that, txtbox should be filled by user.
then that word should match a particular field in the database.
and matched field''s row in db should be displayed in a panel.

推荐答案

您只需分配控件以在customvalidator中进行验证,并在此事件中编写代码

You just assign control to validate in customvalidator and write your code in this event

protected void CustomValidator1_ServerValidate(object source,ServerValidateEventArgs args)
        {
//code to textbox word match with database word.
        }


希望对您有所帮助:)

有关更多查询,请在此处评论!


hope it helps :)

for further queries comment here!


这篇关于如何使用自定义验证器验证文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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