Help With RadTextBox InvalidStyle

3 posts, 0 answers
  1. parlardin
    parlardin avatar
    5 posts
    Member since:
    Jul 2013

    Posted 06 Jul 2013 Link to this post

    i want to Display  InvalidStyle and ErrorMessage inside RadInput,but only display style, the errorMessage not display
    code like this

    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <div>
            <telerik:RadTextBox ID="txtAppId" runat="server" Width="300" AutoPostBack="false">
            </telerik:RadTextBox>
            <asp:RequiredFieldValidator ID="TextBoxRequiredFieldValidator" runat="server" Display="None"
                ControlToValidate="txtAppId" Text="*" ErrorMessage="NOT NULL">                          
            </asp:RequiredFieldValidator>
        </div>
        </form>
    </body>
    </html>
    <script type="text/javascript">
        function ValidatorUpdateDisplay(val) {
            //debugger
            if (typeof (val.display) == "string") {
                if (val.display == "None") {
                    ValidatorUpdateDisplayEnd(val);
                    return;
                }
                if (val.display == "Dynamic") {
                    val.style.display = val.isvalid ? "none" : "inline";
                    return;
                }
            }
            if ((navigator.userAgent.indexOf("Mac") > -1) &&
            (navigator.userAgent.indexOf("MSIE") > -1)) {
                val.style.display = "inline";
            }
            val.style.visibility = val.isvalid ? "hidden" : "visible";
        }
     
        function ValidatorUpdateDisplayEnd(args) {
            //debugger
            var textbox = $find(args.controltovalidate);
            if (textbox) {
                if (args.isvalid) {
                    textbox._invalid = false;
                    textbox.updateCssClass();
                }
                else {
                    textbox.set_textBoxValue("NOT NULL");
                    textbox._invalid = true;
                    textbox.updateCssClass();
                }
            }
        }
    </script>

  2. parlardin
    parlardin avatar
    5 posts
    Member since:
    Jul 2013

    Posted 07 Jul 2013 Link to this post

    i resolve this issue like this:

    function ValidatorUpdateDisplayEnd(args) {
                //debugger
                var textbox = $find(args.controltovalidate);
                if (textbox) {
                    if (args.isvalid) {
                        textbox._invalid = false;
                        textbox.updateCssClass();
                    }
                    else {
                        textbox.set_textBoxValue("NOT NULL");
                        textbox._invalidate();
                        textbox.updateCssClass();
                    }
                }
            }
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. parlardin
    parlardin avatar
    5 posts
    Member since:
    Jul 2013

    Posted 07 Jul 2013 Link to this post

    i resolve this problem like this:
    function ValidatorUpdateDisplayEnd(args) {
                //debugger
                var textbox = $find(args.controltovalidate);
                if (textbox) {
                    if (args.isvalid) {
                        textbox._invalid = false;
                        textbox.updateCssClass();
                    }
                    else {
                        textbox.set_textBoxValue("NOT NULL");
                        textbox._invalidate();
                        textbox.updateCssClass();
                    }
                }
            }
Back to Top