小弟想实现的是当添加的字符串大于100后.就会提示下面是我的代码,为什么我点击提交按钮后
args.IsValid 的值已经为false
但不是提示长度大于100个字符
而且还会继续执行,
把数据录入到数据库<asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="Textname"
          Display="Dynamic" ErrorMessage="长度大于100个字符" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {
        string honorname = args.Value;
        int honorLength = twtclass.GetLength(honorname);
        if (honorLength >= 100)
        {
            args.IsValid = false;
                    }
        else
        {
            args.IsValid = true;
                    }
    }