Open RadWindow on Button Click Event

7 posts, 1 answers
  1. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 08 Jun 2011 Link to this post

    Dear All,

    i have a simple form which is used to login the user to the web application i develop,

    i want to show messages to users in case their username and password are incorrect.

    i want to use the radWindow control.

    i put the following code on my login button click event
    after user name and paswword validating



    RadWindow newWindow = new Telerik.Web.UI.RadWindow





    newWindow.NavigateUrl =




    "My Message Form name"





    newWindow.OpenerElementID = btnLogin.ClientID;

    newWindow.VisibleOnPageLoad =







    newWindow.DestroyOnClose =











    this works fine when click the button by the user...
    but if the page is reloaded/refreshed the window is opened again and again...
    i don't wont this to happen..
    how to prevent the rad window to show if the page is refreshed?

    Hope you can help me....


    Best Regards
  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    5925 posts

    Posted 08 Jun 2011 Link to this post

    Hi Asa'ad,

    When a RadWindow is declared in RadWindowManager it preserves its ViewState which may lead to this unexpected result when the VisibleOnPageLoad property is used with the idea to show the RadWindow only once. Possible solutions for this case are the following ones: 

    • Set EnableViewState = "false" for the RadWindowManager
    • Reset the VisibleOnPageLoad property to false with code when suitable, depending on the particular scenario 
    • Show the RadWindow through registering a script from the server instead (see the this blog post for more information on the matter).

    I hope this helps.

    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 12 Jun 2011 Link to this post

    Thank you marin

    i tried to call the window or alert from code behind using the RadAjaxManager as the following example and it worked for me very well...



    protected void btnOk_Click(object sender, EventArgs e)






    @"radalert('Welcome to RadWindow <b>Prometheus</b>!', 330, 210);");



    thank you again...
  4. Phil
    Phil avatar
    1 posts
    Member since:
    Jul 2012

    Posted 30 Jul 2011 Link to this post

    I added a line of code to reset the window in

    [WindowName].Windows.Clear(); in the pageload.
    Seemed to work, which I thought was a little strange. I was anticipating that I would need to include a trap in the pageload function so that when the button was clicked the [WindowName].Windows.Clear();  line would be bypassed. For some reason my code works without the trap


  5. Kanna
    Kanna avatar
    5 posts
    Member since:
    Aug 2010

    Posted 14 Dec 2011 Link to this post

    This (Asa'ads) code is not working for me. Is there any other properties need to set to my asp button?
    Is there any other way to display an alert box using relerik controls from code behind in
    If yes, please help me out.

    Santhosh Kumar Gudise
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Dec 2011 Link to this post


    Try the following code snippet to open an alert box on button click.
    protected void Button1_Click(object sender, EventArgs e)
          RadWindowManager windowManager = FindControl(this, "WindowManager") as RadWindowManager;
       windowManager.RadAlert("MessageText", 400, null, "title", null);                  
    Note:Make sure you have RadWindowManager on page.

  7. Kanna
    Kanna avatar
    5 posts
    Member since:
    Aug 2010

    Posted 15 Dec 2011 Link to this post

    Here is an easy way to implement alert, prompt,confirm boxes.

    I'm displaying the radAlert box from code behind by using below code and it is working fine for me and easy to implement.

    In aspx,
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true" />
     <asp:Button ID="btnRadAlert1" Text="Show Alert" runat="server" OnClick="btnRadAlert1_Click" />

    In aspx.cs:
    protected void btnRadAlert1_Click(object sender, EventArgs e)
                RadWindowManager1.RadAlert("Successfully created", 200, 100, "Message", null);
                //Like wise u can display confirm, prompt boxes also.

    Hope it might be useful for anyone..!!

    Thanks n Regards,
    Santhosh Kumar Gudise
Back to Top