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

RadWindow reference Error

1 Answer 73 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mojeeb
Top achievements
Rank 1
Mojeeb asked on 23 Mar 2011, 11:25 AM
Hi, I am new to radWindow control. but I have used it quite a lot in my web application till now. I am developing the application in Dot Net Nuke so I have to work in User Controls. On my main page, i display a RadTreeView. If the user clicks an element in the rad tree view, then i show a grid with details of the selected tree node. in this detail grid (which has multiple records for a selected node) I have a button. if the user press this button i open a RadWindow to show more records. I am using all my RadWindows as Control Container, so i put the UserControl in the radWindow's ContentTemplate and set teh VisibleonPageLoad to true if the user press the button. Now in this opened radwindow i display a grid with more records. now in order to add/edit the records in the grid, i use another radwindow (Control Container) to show the edit form. In this radwindow i can open up another radwindow (again control container) to do certain functionality or to select a value from another user control. So in the end i have a Page then radwindow then another radwindow then another radwindow then some more radwindows.
It is working fine in terms of opening the windows and doing some thing in the window. but i can't make the windows to communicate between each other. One thing that came to my mind was to get the reference of the parent rad windows in their childs by using the parent window name, but the problem is that all the user controls which i am using in the radwindows are also used in other application functionality in different ways. so i wanted to make a generic solution so that if the user control is used independently i.e. with out the radwindow, it will still work.
What I am trying to do right now is that in my Last opened radwindow i display some records in a rad grid and the user can select one of the record and press a button on the rad window, which should close this radwindow for record selection and send the selected item as argument to the parent radwindow. (the parent window is not fixed. because the record selection control can be used multiple times in multiple places so i cant hardcode the parent window reference) I need to find the reference of the current window and the reference to the parent widow to pass the arguments or return value. and this can be done on any level (any number of nested windows).
I hope that this long description is enough to understand my problem.

In short: I want to get the reference to the current radwindow (The code available on demo sites gives error) so that i can close the window from client side. I want to send some arguments back to the parent (either page or another window)

 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 25 Mar 2011, 04:02 PM
Hi Mojeeb,

 As far as I understand you have multiple RadWindows which are only used with ContentTemplate and user controls inside those RadWindows from which you want to manipulate the RadWindows.

If so, what I can suggest is the following:

1) Put a function on the main page which does what you want with the RadWindow you want. This function can reference the RadWindow by using $find since they are on the same page. If you do not want to use $find, you can use global javascript variables and assign them to the sender in the OnClientShow event (this will be the RadWindow you open). No matter how you decide to reference the RadWindows, all you need there is to declare the function which manipulates them and which should be executed from the user controls.

2) I assume that the code you have tried is the one with the syntax GetRadWindow().BrowserWindow - it will throw errors because this is used when there is another page through an url set in the RadWindow and in your case you have ContentTemplate. Having ContentTemplate means that all the RadWindow itself and its content are on the same page, so you will have the function declared in 1) on the same page and you can directly call it. However, since you say that you use the same controls on other pages, they might not need this function - that is why before directly calling it from the user control you should check if 1) there is such variable and 2) this variable is of type function. Once you check this, you can simply call the function, no need to reference parent windows because you have everything in the same frame tree hierarchy.

I hope that my reply is helpful, let me know how it goes.

Regards,
Svetlina
the Telerik team
Tags
Window
Asked by
Mojeeb
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or