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

How do I call a client script in radwindow masterpage?

1 Answer 103 Views
Window
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 28 Jun 2013, 07:52 PM


this works great when I want to run the script TestWbform1 on my radwindow

 

function Test2(arg0, arg1, arg2, arg3, arg4) {
    var oWnd = $find("<%=AssmntContentWindow.ClientID%>");
    oWnd.get_contentFrame().contentWindow.TestWbform1(arg0, arg1, arg2, arg3, arg4);
}

 

if I place the script in the masterpage of my radwindow, it no longer works. Can you tell me how to access it there?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 02 Jul 2013, 10:40 AM
Hi Steven,

This is a matter of accessing the control in a separate context. The server code blocks (<%= .... %> syntax) are executed in the context of the file currently being rendered so the AssmntContentWindow control that is declared on the content page is not directly accessible on the master page.

There are several ways to access it and you can choose the one that fits your style, scenario and needs best. Note that the following list cannot be complete and there may be other ways to achieve this:
- create a function that will return the desired popup. It will be in the markup of the content page and will simply do return $find("<%=AssmntContentWindow.ClientID%>"); while on the master page you will call this function instead of $find().
- if the RadWindow is in a RadWindowManager - use the client-side API of the RadWindowManager - the getWindowByName() method and pass the server ID of the control (AssmntContentWindow)
- examine this blog post  that is a bit of a mix from the two approaches


Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Window
Asked by
Steven
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or