中继器项目命令导致验证 [英] Repeater Item Command Causes Validation

查看:53
本文介绍了中继器项目命令导致验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎有一个错误,我有一个带有链接按钮的ASP.NET转发器控件,并且链接按钮的原因验证属性设置为false.

I seem to have a bit of a bug, I have a ASP.NET repeater control with a link buttons in it and the link button has the have the causes validation property set to false.

但是;当单击它以使面板在网页上可见时,asp.net必填字段验证器控件将触发并显示其错误消息.在启用了验证程序控件的那些控件上.

However; when clicking it which makes a panel visible on the web page, the asp.net required field validator controls trigger and shows their error messages. On those controls that I have the validator controls on.

关于什么原因可能导致它忽略了将Causes Validation属性设置为false的任何想法?

Any ideas as to what might cause it to be ignoring the causes validation property set to false?

推荐答案

对于任何有此问题并且偶然发现这篇文章的人,这就是我的发现.

For anybody that has this problem and stumbles across this post, here's what I found.

原来是发生问题的原因是我在Repeater上设置了EnableViewState ="false".这以某种方式破坏了事件回发,并使页面上的每个验证器都触发.我要做的就是从Page_Load()中手动在Repeater上调用DataBind(),然后将其清除.

Turns out the problem was happening because I had EnableViewState="false" set on the Repeater. This was breaking the event postback somehow, and making every validator on the page fire. All I had to do was manually call DataBind() on the Repeater from within Page_Load(), and it cleared right up.

这篇关于中继器项目命令导致验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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