0
以下简单的标记,我在FF和IE8中得到了非常奇怪的行为。如果我把文本框放在焦点上,然后退出,没有任何反应。如果我给出用户名值,并立即删除它,则不会发生任何事情。但是,只有当我提供用户名,标签离开时,才会擦除它并再次拉开标签,最终是否会得到红色星号“必需”标记。该摘要根本不显示。RequiredFieldValidator不工作
这是我尝试使用的标记。看起来像我的问题与EnableClientScript和的ValidationGroup:
<asp:Label ID="userNameLabel" runat="server"
AssociatedControlID="userNameText">
User Name:
</asp:Label>
<asp:TextBox ID="userNameText" runat="server"
Width="200px">
</asp:TextBox>
<asp:RequiredFieldValidator ID="userNameRequired" runat="server"
ControlToValidate="userNameText"
Display="Dynamic"
EnableClientScript="true"
ValidationGroup="userValidation"
ErrorMessage="User Name is always required.">
*
</asp:RequiredFieldValidator>