RadConfirm Always returning False

3 posts, 0 answers
  1. Rodney
    Rodney avatar
    53 posts
    Member since:
    Mar 2015

    Posted 22 Feb 2016 Link to this post

    Hi,

     

    I'm using RadConfirm and initiating it from a C# method. The confirm window pops up just fine, but in my JavaScript arg is always returning false. Here is an example of what I have:

    C#

    protected void txtUserName_DupValidator_ServerValidate(object source, ServerValidateEventArgs args)
    {
        if (hfUserName.Value != txtUserName.TextWithPromptAndLiterals)
        {
            if (!(Controller).IsUsernameUnique(txtUserName.TextWithPromptAndLiterals))
            {
                args.IsValid = false;
                rwmDialogs.RadConfirm("This is an existing user, do you want to edit the existing user or cancel?", "confirmCallBackFn", 300, 250, null, "Verify User");
            }
        }
    }

    JavaScript

    function confirmCallBackFn(arg) {
        //radalert("<strong>radconfirm</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", 350, 250, "Result");
        if (arg = "false") {
            newWindow = openAdminPage("../../../Users");
            return false;
        }
        else {
            PageMethods.DisplayUser(document.getElementById("<%=txtUserName%>".value))
        }
    }

     

    Markup

    <telerik:RadWindowManager ID="rwmDialogs" runat="server" RenderMode="Lightweight" EnableShadow="true"></telerik:RadWindowManager>

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3858 posts

    Posted 22 Feb 2016 Link to this post

    Hello Rodney,

    You should

    • use a comparison check operator (==) instead of an assignment operator (=) in the if-clause
    • compare the variable type and not a string comparison. RadConfirm returns a boolean true, boolean false, or the standard JavaScript null pointer

     

    if (arg == false) {


    Regards,

    Marin Bratanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Rodney
    Rodney avatar
    53 posts
    Member since:
    Mar 2015

    Posted 22 Feb 2016 in reply to Marin Bratanov Link to this post

    Thanks, so simple and I didn't catch it.

    Sorry

Back to Top