I have a validation problem
我有一个验证问题
I have a listview, in the edit item template I have two composite controls with a textbox inside
我有一个listview,在编辑项目模板中我有两个复合控件,里面有一个文本框
I put a comparevalidator on it
我把一个comparevalidator放在上面
<asp:CompareValidator ID="myCompareValidator" runat="server"
ControlToValidate="mycompositecontrol1" ControlToCompare="mycompositecontrol2"
Operator="GreaterThanEqual" Type="Date" Display="Dynamic" ErrorMessage="there is an error !"
Text="!" ValidationGroup="myValidationGroup" />
It works great !
它很棒!
so I do exactly the same operation in the InserItemTemplate (It's a copy/paste)
所以我在InserItemTemplate中执行完全相同的操作(这是一个复制/粘贴)
but this time, it doesn't work, I have no error message in my validationsummary and near my control to validate!
但这一次,它不起作用,我的验证总结和我的控制附近没有错误信息验证!
If you know that problem, help me please
如果你知道这个问题,请帮帮我
thanks in advance
提前致谢
1 个解决方案
#1
This isn't really a good answer to the question directly, but:
这不是一个直接问题的好答案,但是:
I have never had any good luck with the baked in ASP validators. I always try to hammer their square peg into a round hole for a while, get close, get frustrated, then roll my own with my own logic, error messages in labels, and switching visibility with a CSS style.
在ASP验证器中,我从未有过任何好运。我总是试着把他们的方形钉子敲进一个圆孔一段时间,靠近,沮丧,然后用我自己的逻辑滚动我自己,标签中的错误信息,以及用CSS风格切换可见性。
P.S. when you copy pasted your validator, make sure you changed what control it is validating...
附:当您复制粘贴验证器时,请确保您更改了它正在验证的控件...
#1
This isn't really a good answer to the question directly, but:
这不是一个直接问题的好答案,但是:
I have never had any good luck with the baked in ASP validators. I always try to hammer their square peg into a round hole for a while, get close, get frustrated, then roll my own with my own logic, error messages in labels, and switching visibility with a CSS style.
在ASP验证器中,我从未有过任何好运。我总是试着把他们的方形钉子敲进一个圆孔一段时间,靠近,沮丧,然后用我自己的逻辑滚动我自己,标签中的错误信息,以及用CSS风格切换可见性。
P.S. when you copy pasted your validator, make sure you changed what control it is validating...
附:当您复制粘贴验证器时,请确保您更改了它正在验证的控件...