RadWindow OnClientClick function not working

2 posts, 0 answers
  1. Silviu
    Silviu avatar
    62 posts
    Member since:
    Feb 2015

    Posted 15 Feb 2016 Link to this post

    I have a RadWindow created on code behind and when it gets closed I want the server to redirect the user to a specific page which I pass in via a URL parameter as per below:


    protected void DisplayResultsWindow(string URL, string labelText)
                RadWindow resultsWindow = new RadWindow();          
                resultsWindow.Width = Unit.Pixel(600);
                resultsWindow.Height = Unit.Pixel(190);
                resultsWindow.NavigateUrl = "Output.aspx?URL=" + URL + "&Label=" + labelText;
                resultsWindow.VisibleOnPageLoad = true;
                resultsWindow.Modal = true;
                resultsWindow.Behaviors = WindowBehaviors.Close;
                resultsWindow.Skin = "Glow";
                resultsWindow.VisibleStatusbar = false;
                resultsWindow.OnClientClose = "Redirect(" + URL + ")";
                resultsWindow.Title = "Output";

     The JS:

    function Redirect(URL) {
                window.location = URL;
                return false;

    How to correctly navigate to another page (the page and query string coming code behind) when the client closes the window? 

    With the above I keep getting error:

    JavaScript critical error at line 528, column 502 in http://localhost:19113/Manage?DC=Test\n\nSCRIPT1003: Expected ':'

  2. Marin Bratanov
    Marin Bratanov avatar
    4533 posts

    Posted 17 Feb 2016 Link to this post

    Hello Silviu,

    Client-side handlers are attached to our controls by providing the function name only: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/client-side-programming/events/onclientclose. The MS AJAX framework parses that serialized property to a function object that gets added to the stack of handlers.

    With your code, the object will fail to parse with the described error. Thus, you have two possible approaches:



    Marin Bratanov
    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
Back to Top