radAlert x Response.redirect()

2 posts, 0 answers
  1. cayo fontana
    cayo fontana avatar
    9 posts
    Member since:
    Mar 2010

    Posted 09 Jun 2010 Link to this post

    Hi there,

    I have, in a telerik web application, one button making logon of the users. Look:


    <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 


    <asp:Button ID="btnEntrar" runat="server" Text="Entrar" onmouseover="this.style.cursor='hand'"


    OnClick="btnEntrar_Click" />





    In server side, i have 2 states:

    if user was authenticated, response.redirect("page.aspx"),
    else app sends radalert.





    void btnEntrar_Click(object sender, EventArgs e)  







    if ((this.txtLogin.Text == "cayo") && (this.txtSenha.Text == "123"))

















    ScriptManager.RegisterStartupScript(this, this.GetType(), "radalerts", "radalert('Login ou senha <b>inválidos</b>! Favor verificar.', 330, 100);", true);








    If i dont set RadScriptManager1.RegisterPostBackControl(this.btnEntrar); in Page_Load, radalert is work and redirect fails, else, redirect works and radalert fails.

    whats to happen?



  2. Fiko
    Fiko avatar
    1406 posts

    Posted 15 Jun 2010 Link to this post

    Hi Cayo,

    When you call a control that is built upon the MS AJAX library (RadWindwowManager for example) you need to make sure that the library is loaded before calling the methods of the controls. This is why, I recommend you to call the radalert (which is a part of RadWindowManager) using this code:
    protected void btnEntrar_Click(object sender, EventArgs e)
        if (this.TextBox1.Text == "cayo")
            string script = @"function f()
                                radalert('Login ou senha <b>inválidos</b>! Favor verificar.', 330, 100);
                            Sys.Application.add_load(f); ";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "radalerts", script, true);

    I hope this helps.

    Sincerely yours,
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top