的AutoPostBack =真为一个文本框和的RequiredFieldValidator旁边。但是,发布回来TextChanged事件的文本框后,提交表单时,的RequiredFieldValidator不起作用? [英] Autopostback=True for a Textbox and RequiredFieldValidator next to it. But when submitting form after Posting back by TextChanged event to the Textbox, RequiredFieldValidator doesn't work?

查看:183
本文介绍了的AutoPostBack =真为一个文本框和的RequiredFieldValidator旁边。但是,发布回来TextChanged事件的文本框后,提交表单时,的RequiredFieldValidator不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASPX表单我有一个文本框(Textbox1的)用的AutoPostBack = TRUE。
我还设置一个RequiredFieldValidator(RequiredFieldValidator1)旁边。但是,Textbox1的的TextChanged事件回发时,RequiredFieldValidator1出现但我仍可以提交自己的状态有什么到Textbox1的!

aspx form I have a textbox (Textbox1) with Autopostback=True. I also set a RequiredFieldValidator (RequiredFieldValidator1) next to it. But when Posting back by TextChanged event of Textbox1, RequiredFieldValidator1 appears but still I can submit my form with nothing into the Textbox1!

什么是错的?

推荐答案

您必须将文本框的CausesValidation属性设置为true(它在默认情况下为文本框设置为false)。

You have to set the textbox's CausesValidation property to true (it's set to false by default for textboxes).

这篇关于的AutoPostBack =真为一个文本框和的RequiredFieldValidator旁边。但是,发布回来TextChanged事件的文本框后,提交表单时,的RequiredFieldValidator不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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