This is a migrated thread and some comments may be shown as answers.

RadWindow OnClientClick function not working

1 Answer 151 Views
Window
This is a migrated thread and some comments may be shown as answers.
Silviu
Top achievements
Rank 1
Silviu asked on 15 Feb 2016, 11:59 AM

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";
            rwmResultsWindow.Windows.Add(resultsWindow);
        }

 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 ':'

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 17 Feb 2016, 09:50 AM

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:

 

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
Tags
Window
Asked by
Silviu
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or