updatepanel与验证控件的冲突问题,求救!
求教:
我在updatepanel里面放了个TextBox,一个验证该TextBox只能填写数字的验证控件,一个Button。
问题:我第一次在TextBox里面输入字符串,验证控件会有错误提示,然后我更正过来输入数字,验证成功,点击Button把TextBox里的值保存到数据库,这一连串动作都没问题。但是当我再次输入字符串的时候验证控件就自动隐藏了,怎么点按钮都没有反应,这是怎么回事?请各位赐教!
------解决方案--------------------这是微软的一个Bug,你去官网下载一个Validators.dll,放到bin目录下,然后在Web.Config里加上
<tagMapping>
<add tagType= "System.Web.UI.WebControls.CompareValidator " mappedTagType= "Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0 "/>
<add tagType= "System.Web.UI.WebControls.CustomValidator " mappedTagType= "Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0 "/>
<add tagType= "System.Web.UI.WebControls.RangeValidator " mappedTagType= "Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0 "/>
<add tagType= "System.Web.UI.WebControls.RegularExpressionValidator " mappedTagType= "Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0 "/>
<add tagType= "System.Web.UI.WebControls.RequiredFieldValidator " mappedTagType= "Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0 "/>
<add tagType= "System.Web.UI.WebControls.ValidationSummary " mappedTagType= "Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0 "/>
</tagMapping>