RadWindowManager.RadAlert not working

3 posts, 0 answers
  1. Brian
    Brian avatar
    7 posts
    Member since:
    Jun 2011

    Posted 10 Jul 2011 Link to this post

    I am calling the RadAlert function in my code behind when a user clicks on the "Login" button. This is a very simple page with very simple functionality and I am following the examples to a tee, but still nothing. I am thinking it is because I am calling the function within a catch block when the login is unsuccessful, meaning that I am trying to display the window when the execution isn't finished. Can someone help me with this as I am stumped as to how best to proceed? My HTML and C# code is below:

    <form runat="server" id="frmLogin">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
    <telerik:RadWindowManager ID="LoginWindowManager" runat="server" EnableShadow="true" Skin="Telerik" />
        <div class="loginDiv">
            <asp:Image ID="ivxLogo" AlternateText="iVidix Logo" ImageUrl="./img/ividix_logo.jpg" Height="150px"
                        Width="110px" runat="server" />
            <p>Welcome to the Instructional Video Exchange. Please login to access your videos.</p>
            <div align="center">
                <table border="0" cellpadding="0" cellspacing="10">
                    <tr>
                        <td>UserName:</td>
                        <td>
                            <telerik:RadTextBox ID="txtUserName" runat="server" Width="150px" TabIndex="0" Skin="Vista" />
                        </td>
                    </tr>
                    <tr>
                        <td>Password:</td>
                        <td>
                            <telerik:RadTextBox ID="txtPassword" runat="server" Width="150px" TabIndex="1"
                                TextMode="Password" Skin="Vista">
                            </telerik:RadTextBox></td>
                    </tr>
                    <tr>
                        <td>Institution:</td>
                        <td>
                            <telerik:RadComboBox ID="ddlInstitutions" runat="server" DataSourceID="srcInstitutions"
                                DataTextField="Name" DataValueField="InstID" TabIndex="2" Skin="Vista" AllowCustomText="True">
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="right"><asp:Button ID="btnSubmit" runat="server"
                                Text="Login" onclick="btnSubmit_Click" TabIndex="3"/></td>
                    </tr>
                </table>
            </div>
        </div>
    </form>


    try
    {
       String encryptPwd = CryptoHelper.Encrypt(password);
        //log.Debug("Encrypted version of the password: " + password + " is " + encryptPwd);
        userSession = SessionManager.CreateSession(userName, encryptPwd, instID);
    }
    catch (IvidixException ex)
    {
        String ErrorMessage = "UserName and/or Password in combination with the Institution were not valid. Please try again.\n";
        ErrorMessage = ErrorMessage + "Specifically, " + (String) ex.LocalMessages[0] + "\n";
        ErrorMessage = ErrorMessage + "Please contact Ividix Support if you feel that this error is incorrect.";
     
        log.Error("UserDetail Session was not created properly and therefore not stored within the HttpSession.");
        log.Debug("End btnSubmit_Click");
     
        LoginWindowManager.RadAlert(ErrorMessage, 350, 200, "Error", "");
     
        return;
    }

  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 11 Jul 2011 Link to this post

    Hi Brian,

     I examined your code and I noticed that you have an unescaped "\" sign in it - please, note, that this is general JavaScript knowledge and it will break any other javascript, not only radalert (the server RadAlert method is actually a server wrapper for a js radalert method).

    I assume that you meant to set a new line by using "\n" - if  so, please, note, that the message can also parse HTML and "\n" will not produce a new line even if it did not broke the js but you have escaped it. To achieve what you need, please, use the <br/> tag as shown below:


    String ErrorMessage = "UserName and/or Password in combination with the Institution were not valid. Please try again.<br/>";
      
        ErrorMessage = ErrorMessage + "Specifically, " + (String) ex.LocalMessages[0] + "<br/>";
      
        ErrorMessage = ErrorMessage + "Please contact Ividix Support if you feel that this error is incorrect.";

    Please, test my suggestion and let me know how it goes.

    Best wishes,
    Svetlina
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian
    Brian avatar
    7 posts
    Member since:
    Jun 2011

    Posted 11 Jul 2011 Link to this post

    Svetlina,

    You were completely dead on. I did not realize that the server-side call was just a wrapper for the client-side function. That is not very clear from the documentation.

    That being said, I didn't even think about the message that I am displaying because I wrote that code so long ago. As soon as I changed it to use break tags, everything worked just fine. Thank you very much for the help.

    Brian
Back to Top